SeqAn3  3.0.0
The Modern C++ library for sequence analysis.
char_to.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2019, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2019, 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 
18 #include <seqan3/std/ranges>
19 
20 namespace seqan3::view
21 {
22 
69 template <Alphabet alphabet_type>
70 inline auto const char_to = deep{std::view::transform([] (auto && in)
71 {
72  static_assert(std::CommonReference<decltype(in), alphabet_char_t<alphabet_type>>,
73  "The innermost value type must have a common reference to underlying char type of alphabet_type.");
74  // call element-wise assign_char from the Alphabet
75  return assign_char_to(in, alphabet_type{});
76 })};
77 
79 
80 } // namespace seqan3::view
Provides seqan3::view::deep.
Adaptations of concepts from the Ranges TS.
decltype(seqan3::to_char(std::declval< alphabet_type const >())) alphabet_char_t
The char_type of the alphabet; defined as the return type of seqan3::to_char.
Definition: concept.hpp:294
The SeqAn3 namespace for views.
The concept std::CommonReference<T, U> specifies that two types T and U share a common reference type...
Provides various type traits on generic types.
Core alphabet concept and free function/type trait wrappers.
A wrapper type around an existing view adaptor that enables "deep view" behaviour for that view...
Definition: deep.hpp:101
constexpr auto assign_char_to
Assign a character to an alphabet object.
Definition: concept.hpp:395
constexpr auto transform
A range adaptor that takes a invocable and returns a view of the elements with the invocable applied...
Definition: ranges:911
auto const char_to
A view over an alphabet, given a range of characters.
Definition: char_to.hpp:70