SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
alphabet/detail/convert.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
12#pragma once
13
14#include <array>
15
17
18// ============================================================================
19// conversion to/from char/rank types
20// ============================================================================
21
22namespace seqan3::detail
23{
24
25// clang-format off
32template <alphabet in_t, alphabet out_t>
34{
35 []() constexpr {
37
38 // for (decltype(alphabet_size<in_t>) i = 0; ...) causes indefinite compilation :(
39 for (auto i = decltype(alphabet_size<in_t>){0}; i < alphabet_size<in_t>; ++i)
40 assign_char_to(to_char(assign_rank_to(i, in_t{})), ret[i]);
41
42 return ret;
43 }()
44};
45// clang-format on
46
47} // namespace seqan3::detail
Core alphabet concept and free function/type trait wrappers.
constexpr auto assign_char_to
Assign a character to an alphabet object.
Definition alphabet/concept.hpp:521
constexpr auto to_char
Return the char representation of an alphabet object.
Definition alphabet/concept.hpp:383
constexpr auto assign_rank_to
Assign a rank to an alphabet object.
Definition alphabet/concept.hpp:290
constexpr std::array< out_t, alphabet_size< in_t > > convert_through_char_representation
A precomputed conversion table for two alphabets based on their char representations.
Definition alphabet/detail/convert.hpp:34
The internal SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
Hide me