SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
seqan3::pod_tuple< type0, types... > Struct Template Reference

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

#include <seqan3/utility/tuple/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.
 

Additional Inherited Members

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).

You can use seqan3::get or std::get and also structured bindings to access the elements in the tuple.

// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: CC0-1.0
int main()
{
static_assert(std::is_standard_layout_v<seqan3::pod_tuple<int, float>>);
static_assert(std::is_trivial_v<seqan3::pod_tuple<int, float>>);
seqan3::debug_stream << std::get<int>(tuple1) << '\n'; // 3
// template parameters are automatically deduced:
seqan3::pod_tuple tuple2{17, 3.7f, 19l};
seqan3::debug_stream << std::get<0>(tuple2) << '\n'; // 17
auto [i, f, l] = tuple2; // creates an int i with value 17, float f...
seqan3::debug_stream << i << ',' << f << ',' << l << '\n'; // 17,3.7,19
}
Provides seqan3::debug_stream and related types.
debug_stream_type debug_stream
A global instance of seqan3::debug_stream_type.
Definition debug_stream.hpp:37
Provides seqan3::pod_tuple.
Definition pod_tuple.hpp:26

The documentation for this struct was generated from the following file:
Hide me