SeqAn3 3.2.0
The Modern C++ library for sequence analysis.
validate_char_for.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2022, Knut Reinert & MPI für molekulare Genetik
4// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6// -----------------------------------------------------------------------------------------------------
7
13#pragma once
14
15#include <ranges>
16
20
21namespace seqan3::views
22{
72template <alphabet alphabet_type>
74 []<typename char_t>(char_t && in) -> char_t
75 {
76 static_assert(
77 std::common_reference_with<char_t, alphabet_char_t<alphabet_type>>,
78 "The innermost value type must have a common reference to underlying char type of alphabet_type.");
79
80 if (!char_is_valid_for<alphabet_type>(in))
81 {
82 throw seqan3::invalid_char_assignment{"alphabet_type", in};
83 }
84 return std::forward<char_t>(in);
85 })};
86
87} // 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:104
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:73
decltype(detail::transform< trait_t >(list_t{})) transform
Apply a transformation trait to every type in the list and return a seqan3::type_list of the results.
Definition: traits.hpp:470
The SeqAn namespace for views.
Definition: char_strictly_to.hpp:22
An exception typically thrown by seqan3::alphabet::assign_char_strict.
Definition: exception.hpp:30