Loading...
Searching...
No Matches
alphabet/detail/convert.hpp
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <array>
#include <seqan3/alphabet/detail/concept.hpp>
// ============================================================================
// conversion to/from char/rank types
// ============================================================================
namespace seqan3::detail
{
template <typename in_t, typename out_t>
requires convertable_to_through_char_representation<in_t, out_t>
constexpr std::array<out_t, alphabet_size<in_t>> convert_through_char_representation{
[]() constexpr
{
std::array<out_t, alphabet_size<in_t>> ret{};
// for (decltype(alphabet_size<in_t>) i = 0; ...) causes indefinite compilation :(
for (auto i = decltype(alphabet_size<in_t>){0}; i < alphabet_size<in_t>; ++i)
assign_char_to(to_char(assign_rank_to(i, in_t{})), ret[i]);
return ret;
}()};
} // namespace seqan3::detail
concept.hpp
Provides alphabet helper concepts.
array
seqan3::assign_char_to
constexpr auto assign_char_to
Assign a character to an alphabet object.
Definition alphabet/concept.hpp:517
seqan3::to_char
constexpr auto to_char
Return the char representation of an alphabet object.
Definition alphabet/concept.hpp:381
seqan3::alphabet_size
constexpr auto alphabet_size
A type trait that holds the size of a (semi-)alphabet.
Definition alphabet/concept.hpp:834
seqan3::assign_rank_to
constexpr auto assign_rank_to
Assign a rank to an alphabet object.
Definition alphabet/concept.hpp:288
Hide me