SeqAn3
3.4.0
The Modern C++ library for sequence analysis.
Toggle main menu visibility
Loading...
Searching...
No Matches
utility/views/convert.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
2
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
3
// SPDX-License-Identifier: BSD-3-Clause
4
9
10
#pragma once
11
12
#include <concepts>
13
#include <ranges>
14
15
#include <
seqan3/utility/concept.hpp
>
16
17
namespace
seqan3::views
18
{
65
template
<
typename
out_t>
66
inline
constexpr
auto
convert
= std::views::transform(
67
[](
auto
&& in) -> out_t
68
{
69
static_assert
(std::convertible_to<
decltype
(in) &&, out_t> ||
explicitly_convertible_to
<
decltype
(in) &&, out_t>,
70
"The reference type of the input to views::convert is not convertible to out_t."
);
71
72
if
constexpr
(std::convertible_to<
decltype
(in) &&, out_t>)
73
return
std::forward
<
decltype
(in)>(in);
74
else
75
return
static_cast<
out_t
>
(
std::forward<decltype(in)>
(in));
76
});
77
78
}
// namespace seqan3::views
std::forward
T forward(T... args)
seqan3::views::convert
constexpr auto convert
A view that converts each element in the input range (implicitly or via static_cast).
Definition
utility/views/convert.hpp:66
explicitly_convertible_to
Checks whether from can be explicitly converted to to.
seqan3::views
The SeqAn namespace for views.
Definition
char_strictly_to.hpp:19
concept.hpp
Provides concepts that do not have equivalents in C++20.
Hide me
Version:
seqan3
utility
views
convert.hpp
Generated on
for SeqAn3 by
1.17.0