Loading...
Searching...
No Matches
validate_char_for.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/alphabet/concept.hpp>
#include <seqan3/utility/type_traits/basic.hpp>
#include <seqan3/utility/views/deep.hpp>
namespace seqan3::views
{
template <alphabet alphabet_type>
inline auto const validate_char_for = deep{std::views::transform(
[]<typename char_t>(char_t && in) -> char_t
{
static_assert(
std::common_reference_with<char_t, alphabet_char_t<alphabet_type>>,
"The innermost value type must have a common reference to underlying char type of alphabet_type.");
if (!char_is_valid_for<alphabet_type>(in))
{
throw seqan3::invalid_char_assignment{"alphabet_type", in};
}
return std::forward<char_t>(in);
})};
} // namespace seqan3::views
concept.hpp
Core alphabet concept and free function/type trait wrappers.
basic.hpp
Provides various type traits on generic types.
seqan3::views::deep
A wrapper type around an existing view adaptor that enables "deep view" behaviour for that view.
Definition deep.hpp:101
deep.hpp
Provides seqan3::views::deep.
std::forward
T forward(T... args)
seqan3::views::validate_char_for
auto const validate_char_for
An identity view that throws if an encountered character is not valid for the given alphabet.
Definition validate_char_for.hpp:70
seqan3::char_is_valid_for
constexpr auto char_is_valid_for
Returns whether a character is in the valid set of a seqan3::alphabet (usually implies a bijective ma...
Definition alphabet/concept.hpp:661
seqan3::views
The SeqAn namespace for views.
Definition char_strictly_to.hpp:19
seqan3::invalid_char_assignment
An exception typically thrown by seqan3::alphabet::assign_char_strict.
Definition alphabet/exception.hpp:27
Hide me