SeqAn3
3.4.0
The Modern C++ library for sequence analysis.
Toggle main menu visibility
Loading...
Searching...
No Matches
char.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
2
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
3
// SPDX-License-Identifier: BSD-3-Clause
4
22
23
#pragma once
24
25
#include <
seqan3/alphabet/concept.hpp
>
26
#include <
seqan3/utility/detail/integer_traits.hpp
>
27
28
namespace
seqan3::detail
29
{
33
template
<
typename
type>
34
constexpr
bool
is_char_adaptation_v =
35
std::same_as<type, char> || std::same_as<type, char8_t> || std::same_as<type, char16_t>
36
|| std::same_as<type, char32_t> || std::same_as<type, wchar_t>;
37
}
// namespace seqan3::detail
38
39
namespace
seqan3::custom
40
{
41
48
template
<
typename
char
_type>
49
requires
detail::is_char_adaptation_v<char_type>
50
struct
alphabet
<char_type>
51
{
56
static
constexpr
auto
alphabet_size
=
57
detail::min_viable_uint_t<detail::size_in_values_v<char_type>>{detail::size_in_values_v<char_type>};
58
65
static
constexpr
char_type
to_char
(char_type
const
chr)
noexcept
66
{
67
return
chr;
68
}
69
76
static
constexpr
auto
to_rank
(char_type
const
chr)
noexcept
77
{
78
return
static_cast<
detail::min_viable_uint_t<
alphabet_size
- 1
>
>(chr);
79
}
80
88
static
constexpr
char_type &
assign_char_to
(char_type
const
chr2, char_type & chr)
noexcept
89
{
90
return
chr = chr2;
91
}
92
100
static
constexpr
char_type &
assign_rank_to
(
decltype
(alphabet::to_rank(char_type{}))
const
rank,
101
char_type & chr)
noexcept
102
{
103
return
chr = rank;
104
}
105
};
106
107
}
// namespace seqan3::custom
concept.hpp
Core alphabet concept and free function/type trait wrappers.
integer_traits.hpp
Provides metaprogramming utilities for integer types.
seqan3::custom
A namespace for third party and standard library specialisations of SeqAn customisation points.
Definition
char.hpp:40
seqan3::custom::alphabet< char_type >::to_rank
static constexpr auto to_rank(char_type const chr) noexcept
Convert char to rank by casting to an unsigned integral type of same size.
Definition
char.hpp:76
seqan3::custom::alphabet< char_type >::alphabet_size
static constexpr auto alphabet_size
The number of values the char type can take (e.g. 256 for char).
Definition
char.hpp:56
seqan3::custom::alphabet< char_type >::assign_char_to
static constexpr char_type & assign_char_to(char_type const chr2, char_type &chr) noexcept
Assign a char to the char type (same as calling =).
Definition
char.hpp:88
seqan3::custom::alphabet< char_type >::to_char
static constexpr char_type to_char(char_type const chr) noexcept
Converting char to char is no-op (it will just return the value you pass in).
Definition
char.hpp:65
seqan3::custom::alphabet< char_type >::assign_rank_to
static constexpr char_type & assign_rank_to(decltype(alphabet::to_rank(char_type{})) const rank, char_type &chr) noexcept
Assigning a rank to a char is the same as assigning it a numeric value.
Definition
char.hpp:100
seqan3::custom::alphabet
A type that can be specialised to provide customisation point implementations so that third party typ...
Definition
alphabet/concept.hpp:46
Hide me
Version:
seqan3
alphabet
adaptation
char.hpp
Generated on
for SeqAn3 by
1.17.0