Additional helper utilities for "tuple" types like std::tuple, std::pair, seqan3::pod_tuple that are not specific to a SeqAn module.
More...
Additional helper utilities for "tuple" types like std::tuple, std::pair, seqan3::pod_tuple that are not specific to a SeqAn module.
- See also
- Utility
- Todo:
- write me.
◆ common_pair
A common pair type that behaves like a regular std::pair, but can be used as a reference type proxy for output iterators.
Alias definition of the ranges::common_pair.
◆ common_tuple
A common tuple type that behaves like a regular std::tuple, but can be used as a reference type proxy for output iterators.
Alias definition of the ranges::common_tuple.
◆ tuple_type_list_t
template<detail::tuple_size tuple_t>
◆ tuple_pop_front()
template<tuple_like tuple_t>
constexpr auto seqan3::tuple_pop_front |
( |
tuple_t && |
t | ) |
|
|
constexpr |
Removes the first element of a tuple.
- Parameters
-
- Returns
- A new tuple without the first element of
t
.
Note, that the tuple must contain at least one element and must support empty tuple types, i.e. std::pair cannot be used.
Complexity
Linear in the number of elements.
Thread safety
Concurrent invocations of this functions are thread safe.
◆ tuple_split() [1/3]
template<typename pivot_t , tuple_like tuple_t>
constexpr auto seqan3::tuple_split |
( |
tuple_t && |
t | ) |
|
|
constexpr |
Splits a tuple like data structure at the first position of the given type.
- Template Parameters
-
pivot_t | A template type specifying the split position. |
- Parameters
-
[in] | t | The original tuple to split. |
- Returns
- A new tuple of tuples with the left side of the split and the right side of the split.
Splits a tuple into two tuples, while the element at the split position will be contained in the second tuple. Note, that the returned tuples can be empty. For this reason it is not possible to use tuple like objects, that cannot be empty, i.e. std::pair. Using such an object will emit an compiler error.
example
int main()
{
auto [
left,
right] = seqan3::tuple_split<2>(t);
auto [left1, right1] = seqan3::tuple_split<0>(t);
auto [left2, right2] = seqan3::tuple_split<4>(t);
}
Provides seqan3::tuple_split.
Complexity
Linear in the number of elements.
Thread safety
Concurrent invocations of this functions are thread safe.
◆ tuple_split() [2/3]
template<size_t pivot_c, template< typename ... > typename tuple_t, typename ... ts>
constexpr auto seqan3::tuple_split |
( |
tuple_t< ts... > const & |
t | ) |
|
|
constexpr |
Splits a tuple like data structure at the given position.
- Template Parameters
-
pivot_c | A template value specifying the split position. |
tuple_t | A template alias for a tuple like object. |
...ts | Types tuple_t is specified with. |
- Parameters
-
[in] | t | The original tuple to split. |
- Returns
- A new tuple of tuples with the left side of the split and the right side of the split.
Splits a tuple into two tuples, while the element at the split position will be contained in the second tuple. Note, that the returned tuples can be empty. For this reason it is not possible to use tuple like objects, that cannot be empty, i.e. std::pair. Using such an object will emit an compiler error.
example
int main()
{
auto [
left,
right] = seqan3::tuple_split<2>(t);
auto [left1, right1] = seqan3::tuple_split<0>(t);
auto [left2, right2] = seqan3::tuple_split<4>(t);
}
Complexity
Linear in the number of elements.
Thread safety
Concurrent invocations of this functions are thread safe.
◆ tuple_split() [3/3]
template<size_t beg, template< typename ... > typename tuple_t, size_t ... Is, typename ... ts>
constexpr auto seqan3::detail::tuple_split |
( |
tuple_t< ts... > const & |
t, |
|
|
std::index_sequence< Is... > const & |
idx |
|
) |
| |
|
constexpr |
Helper function for seqan3::tuple_split.
- Template Parameters
-
beg | A template value containing the start position from where to extract the values. |
tuple_t | A template alias for a tuple like object. |
...ts | Types tuple_t is specified with. |
...Is | Indices of the tuple elements that should be extracted. |
- Parameters
-
[in] | t | The original tuple to split. |
[in] | idx | An std::index_sequence with all indices that should be extracted beginning at beg . |
- Returns
- A new tuple with the extracted elements.