Loading...
Searching...
No Matches
elements.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <ranges>
#include <seqan3/utility/tuple/concept.hpp>
#include <seqan3/utility/type_traits/basic.hpp>
namespace seqan3::views
{
template <auto index>
inline constexpr auto elements = std::views::transform(
[](auto && in) -> decltype(auto)
{
using std::get;
using seqan3::get;
using element_t = decltype(in);
static_assert(tuple_like<element_t>,
"You may only pass ranges to views::element_t whose reference_t models tuple_like.");
// we need to explicitly remove && around temporaries to return values as values (and not as rvalue references)
// we cannot simply cast to std::tuple_element_t (or set that as return value), because some tuples, like
// our alphabet_tuple_base alphabets do not return that type when get is called on them (they return a proxy)
using ret_type = remove_rvalue_reference_t<decltype(get<index>(std::forward<element_t>(in)))>;
return static_cast<ret_type>(get<index>(std::forward<element_t>(in)));
});
} // namespace seqan3::views
basic.hpp
Provides various type traits on generic types.
std::forward
T forward(T... args)
seqan3::views::elements
constexpr auto elements
A view calling get on each element in a range.
Definition elements.hpp:77
tuple_like
Whether a type behaves like a tuple.
seqan3::views
The SeqAn namespace for views.
Definition char_strictly_to.hpp:19
seqan3::get
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
concept.hpp
Provides seqan3::tuple_like.
Hide me