SeqAn3  3.0.1
The Modern C++ library for sequence analysis.
seqan3::pod_tuple< type0, types... > Struct Template Reference

Behaves like std::tuple but is an aggregate PODType. More...

#include <seqan3/core/pod_tuple.hpp>

+ Inheritance diagram for seqan3::pod_tuple< type0, types... >:

Public Member Functions

Comparison operators
constexpr bool operator== (pod_tuple const &rhs) const noexcept
 Checks whether *this is equal to rhs.
 
constexpr bool operator!= (pod_tuple const &rhs) const noexcept
 Checks whether *this is not equal to rhs.
 
constexpr bool operator< (pod_tuple const &rhs) const noexcept
 Checks whether *this is less than rhs.
 
constexpr bool operator> (pod_tuple const &rhs) const noexcept
 Checks whether *this is greater than rhs.
 
constexpr bool operator<= (pod_tuple const &rhs) const noexcept
 Checks whether *this is less than or equal to rhs.
 
constexpr bool operator>= (pod_tuple const &rhs) const noexcept
 Checks whether *this is greater than or equal to rhs.
 

Related Functions

(Note that these are not member functions.)

Requirements for seqan3::tuple_like

You can expect these (meta-)functions on all types that implement seqan3::tuple_like.

size_t tuple_size_v
 A unary type trait that holds the number of elements in the tuple. More...
 
 tuple_elment_t
 A transformation trait that holds the type of elements in the tuple. More...
 
auto && get (type &&val)
 Return the i-th element of the tuple. More...
 
Requirements for std::totally_ordered

You can expect these functions on all types that implement std::totally_ordered.

bool operator< (type const &lhs, type const &rhs)
 Less-than, greater-than and -or-equal comparisons. More...
 
bool operator<= (type const &lhs, type const &rhs)
 Less-than, greater-than and -or-equal comparisons. More...
 
bool operator> (type const &lhs, type const &rhs)
 Less-than, greater-than and -or-equal comparisons. More...
 
bool operator>= (type const &lhs, type const &rhs)
 Less-than, greater-than and -or-equal comparisons. More...
 
Requirements for std::equality_comparable

You can expect these functions on all types that implement std::Equality_comparable.

bool operator== (type const &lhs, type const &rhs)
 (In-)Equality comparison. More...
 
bool operator!= (type const &lhs, type const &rhs)
 (In-)Equality comparison. More...
 

Detailed Description

template<typename type0, typename ... types>
struct seqan3::pod_tuple< type0, types... >

Behaves like std::tuple but is an aggregate PODType.

Template Parameters
type0The first type (the first type).
...types0-n types (the remaining types of the values to be stored).

This class behaves like std::tuple, but it is itself a POD type while std::tuple is not (even if all contained types are POD). Since the only benefit of this class is that it stays POD it actually enforces this on all types in the tuple (if you want to add non POD types, just use std::tuple instead).

It (only) supports aggregate initialization, i.e. you must use brace-initializiers and cannot use paranthesis. You can use seqan3::get or std::get and also structured bindings to access the elements in the tuple.

int main()
{
// template parameters are automatically deduced:
seqan3::pod_tuple t2{17, 3.7f, 19l};
seqan3::debug_stream << std::get<0>(t2) << '\n'; // 17
auto [ i, f, l ] = t2; // creates an int i with value 17, float f...
}

Friends And Related Function Documentation

◆ get()

auto && get< i > ( type &&  val)
related

Return the i-th element of the tuple.

Template Parameters
iThe index of the element to return (of type size_t).
Parameters
[in,out]valThe tuple-like object to operate on.
Returns
The i-th value in the tuple.
Attention
This is a concept requirement, not an actual function (however types satisfying this concept will provide an implementation).
This constraint is not enforced since empty tuples are valid.

◆ tuple_elment_t()

tuple_elment_t
related

A transformation trait that holds the type of elements in the tuple.

Template Parameters
iIndex of the queried element type.
typeThe tuple-like type.
Attention
This is a concept requirement, not an actual function (however types satisfying this concept will provide an implementation).
This constraint is not enforced since empty tuples are valid.

◆ tuple_size_v()

size_t tuple_size_v
related

A unary type trait that holds the number of elements in the tuple.

Template Parameters
typeThe tuple-like type.
Attention
This is a concept requirement, not an actual function (however types satisfying this concept will provide an implementation).

The documentation for this struct was generated from the following file:
debug_stream.hpp
Provides seqan3::debug_stream and related types.
pod_tuple.hpp
Provides seqan3::pod_tuple.
std::is_pod_v
T is_pod_v
seqan3::pod_tuple
cond
Definition: pod_tuple.hpp:30