SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
validate_char_for.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
17
18namespace seqan3::views
19{
69template <alphabet alphabet_type>
70inline auto const validate_char_for = deep{std::views::transform(
71 []<typename char_t>(char_t && in) -> char_t
72 {
73 static_assert(
74 std::common_reference_with<char_t, alphabet_char_t<alphabet_type>>,
75 "The innermost value type must have a common reference to underlying char type of alphabet_type.");
76
77 if (!char_is_valid_for<alphabet_type>(in))
78 {
79 throw seqan3::invalid_char_assignment{"alphabet_type", in};
80 }
81 return std::forward<char_t>(in);
82 })};
83
84} // namespace seqan3::views
Core alphabet concept and free function/type trait wrappers.
Provides various type traits on generic types.
A wrapper type around an existing view adaptor that enables "deep view" behaviour for that view.
Definition deep.hpp:101
Provides seqan3::views::deep.
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
The SeqAn namespace for views.
Definition char_strictly_to.hpp:19
An exception typically thrown by seqan3::alphabet::assign_char_strict.
Definition alphabet/exception.hpp:27
Hide me