SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
elements.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <ranges>
13
16
17namespace seqan3::views
18{
76template <auto index>
77inline constexpr auto elements = std::views::transform(
78 [](auto && in) -> decltype(auto)
79 {
80 using std::get;
81 using seqan3::get;
82
83 using element_t = decltype(in);
84
85 static_assert(tuple_like<element_t>,
86 "You may only pass ranges to views::element_t whose reference_t models tuple_like.");
87
88 // we need to explicitly remove && around temporaries to return values as values (and not as rvalue references)
89 // we cannot simply cast to std::tuple_element_t (or set that as return value), because some tuples, like
90 // our alphabet_tuple_base alphabets do not return that type when get is called on them (they return a proxy)
91 using ret_type = remove_rvalue_reference_t<decltype(get<index>(std::forward<element_t>(in)))>;
92 return static_cast<ret_type>(get<index>(std::forward<element_t>(in)));
93 });
94
95} // namespace seqan3::views
Provides various type traits on generic types.
A "pretty printer" for most SeqAn data structures and related types.
Definition debug_stream_type.hpp:79
constexpr auto elements
A view calling get on each element in a range.
Definition elements.hpp:77
The SeqAn namespace for views.
Definition char_strictly_to.hpp:19
constexpr auto const & get(configuration< configs_t... > const &config) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition configuration.hpp:412
Provides seqan3::tuple_like.
Hide me