SeqAn3  3.2.0
The Modern C++ library for sequence analysis.
char_to.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 
21 namespace seqan3::views
22 {
66 template <alphabet alphabet_type>
67 inline auto const char_to = deep{std::views::transform(
68  [](auto && in)
69  {
70  static_assert(
71  std::common_reference_with<decltype(in), alphabet_char_t<alphabet_type>>,
72  "The innermost value type must have a common reference to underlying char type of alphabet_type.");
73  // call element-wise assign_char from the alphabet
74  return assign_char_to(in, alphabet_type{});
75  })};
76 
77 } // 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 char_to
A view over an alphabet, given a range of characters.
Definition: char_to.hpp:67
constexpr auto assign_char_to
Assign a character to an alphabet object.
Definition: alphabet/concept.hpp:524
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: type_list/traits.hpp:469
The SeqAn namespace for views.
Definition: char_strictly_to.hpp:22
The <ranges> header from C++20's standard library.