SeqAn3 3.3.0-rc.1
The Modern C++ library for sequence analysis.
alphabet/detail/convert.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
15#pragma once
16
17#include <array>
18
20
21// ============================================================================
22// conversion to/from char/rank types
23// ============================================================================
24
25namespace seqan3::detail
26{
27
28// clang-format off
35template <alphabet in_t, alphabet out_t>
37{
38 []() constexpr {
40
41 // for (decltype(alphabet_size<in_t>) i = 0; ...) causes indefinite compilation :(
42 for (auto i = decltype(alphabet_size<in_t>){0}; i < alphabet_size<in_t>; ++i)
43 assign_char_to(to_char(assign_rank_to(i, in_t{})), ret[i]);
44
45 return ret;
46 }()
47};
48// clang-format on
49
50} // 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:524
constexpr auto to_char
Return the char representation of an alphabet object.
Definition: alphabet/concept.hpp:386
constexpr auto assign_rank_to
Assign a rank to an alphabet object.
Definition: alphabet/concept.hpp:293
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:37
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29