Skip to content

Commit cd692e3

Browse files
smehringereseiler
andauthored
[FIX] Restrict seqan3::alphabet_variant. (#2868)
* [FIX] Restrict seqan3::alphabet_variant to only accept alphabets with the same underlying char type. * Apply suggestions from code review Co-authored-by: Enrico Seiler <eseiler@users.noreply.github.com>
1 parent 3a9932f commit cd692e3

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

include/seqan3/alphabet/composite/alphabet_variant.hpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,21 @@ template <typename ...alternative_types>
122122
requires (detail::writable_constexpr_alphabet<alternative_types> && ...) &&
123123
(std::regular<alternative_types> && ...) &&
124124
(sizeof...(alternative_types) >= 2)
125-
//TODO same char_type
126125
//!\endcond
127126
class alphabet_variant : public alphabet_base<alphabet_variant<alternative_types...>,
128-
(static_cast<size_t>(alphabet_size<alternative_types>) + ...),
129-
char> //TODO underlying char t
130-
127+
(static_cast<size_t>(alphabet_size<alternative_types>) + ...),
128+
char>
131129
{
132130
private:
133131
//!\brief The base type.
134132
using base_t = alphabet_base<alphabet_variant<alternative_types...>,
135-
(static_cast<size_t>(alphabet_size<alternative_types>) + ...),
136-
char>;
133+
(static_cast<size_t>(alphabet_size<alternative_types>) + ...),
134+
char>;
135+
136+
static_assert((std::is_same_v<alphabet_char_t<alternative_types>, char> && ...),
137+
"The alphabet_variant is currently only tested for alphabets with char_type char. "
138+
"Contact us on GitHub if you have a different use case: https://github.com/seqan/seqan3 .");
139+
137140
//!\brief Befriend the base type.
138141
friend base_t;
139142

include/seqan3/alphabet/composite/detail.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ template <typename ...alternative_types>
200200
requires (detail::writable_constexpr_alphabet<alternative_types> && ...) &&
201201
(std::regular<alternative_types> && ...) &&
202202
(sizeof...(alternative_types) >= 2)
203-
//TODO same char_type
204203
//!\endcond
205204
class alphabet_variant;
206205

0 commit comments

Comments
 (0)