Skip to content

Commit

Permalink
[fix] build on GCC13
Browse files Browse the repository at this point in the history
  • Loading branch information
h-2 committed Jul 21, 2023
1 parent 7183266 commit d13c863
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 77 deletions.
69 changes: 41 additions & 28 deletions include/bio/alphabet/base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ class base
friend constexpr auto tag_invoke(custom::to_rank, derived_type const a) noexcept { return a.to_rank(); }

//!\brief tag_invoke() wrapper around member.
friend constexpr derived_type & tag_invoke(custom::assign_rank_to, rank_type const r, derived_type & a) noexcept
template <std::same_as<derived_type> derived_type_>
friend constexpr derived_type & tag_invoke(custom::assign_rank_to, rank_type const r, derived_type_ & a) noexcept
requires(requires {
{
a.assign_rank(r)
Expand All @@ -211,7 +212,8 @@ class base
}

//!\brief tag_invoke() wrapper around member.
friend constexpr auto tag_invoke(custom::to_char, derived_type const a) noexcept
template <std::same_as<derived_type> derived_type_>
friend constexpr auto tag_invoke(custom::to_char, derived_type_ const a) noexcept
requires(requires {
{
a.to_char()
Expand All @@ -222,7 +224,8 @@ class base
}

//!\brief tag_invoke() wrapper around member.
friend constexpr derived_type & tag_invoke(custom::assign_char_to, char_type const c, derived_type & a) noexcept
template <std::same_as<derived_type> derived_type_>
friend constexpr derived_type_ & tag_invoke(custom::assign_char_to, char_type const c, derived_type_ & a) noexcept
requires(requires {
{
a.assign_char(c)
Expand All @@ -233,39 +236,43 @@ class base
}

//!\brief tag_invoke() wrapper around member.
friend constexpr bool tag_invoke(custom::char_is_valid_for, char_type const c, derived_type) noexcept
template <std::same_as<derived_type> derived_type_>
friend constexpr bool tag_invoke(custom::char_is_valid_for, char_type const c, derived_type_) noexcept
requires(requires {
{
derived_type::char_is_valid(c)
derived_type_::char_is_valid(c)
};
})
{
return derived_type::char_is_valid(c);
return derived_type_::char_is_valid(c);
}

//!\brief tag_invoke() wrapper around member.
template <std::same_as<derived_type> derived_type_>
friend constexpr bool tag_invoke(custom::char_is_valid_for,
char_type const c,
std::type_identity<derived_type>) noexcept
std::type_identity<derived_type_>) noexcept
requires(requires {
{
derived_type::char_is_valid(c)
derived_type_::char_is_valid(c)
};
} && !meta::constexpr_default_initializable<derived_type>)
} && !meta::constexpr_default_initializable<derived_type_>)
{
return derived_type::char_is_valid(c);
return derived_type_::char_is_valid(c);
}

//!\brief tag_invoke() wrapper around member.
friend consteval auto tag_invoke(custom::size, derived_type) noexcept
requires meta::constexpr_default_initializable<derived_type>
template <std::same_as<derived_type> derived_type_>
friend consteval auto tag_invoke(custom::size, derived_type_) noexcept
requires meta::constexpr_default_initializable<derived_type_>
{
return size;
}

//!\brief tag_invoke() wrapper around member.
friend consteval auto tag_invoke(custom::size, std::type_identity<derived_type>) noexcept
requires(!meta::constexpr_default_initializable<derived_type>)
template <std::same_as<derived_type> derived_type_>
friend consteval auto tag_invoke(custom::size, std::type_identity<derived_type_>) noexcept
requires(!meta::constexpr_default_initializable<derived_type_>)
{
return size;
}
Expand Down Expand Up @@ -367,7 +374,8 @@ class base<derived_type, 1ul, char_t>
}

//!\brief tag_invoke() wrapper around member.
friend constexpr auto tag_invoke(custom::to_char, derived_type const a) noexcept
template <std::same_as<derived_type> derived_type_>
friend constexpr auto tag_invoke(custom::to_char, derived_type_ const a) noexcept
requires(requires {
{
a.to_char()
Expand All @@ -378,7 +386,8 @@ class base<derived_type, 1ul, char_t>
}

//!\brief tag_invoke() wrapper around member.
friend constexpr derived_type & tag_invoke(custom::assign_char_to, char_type const c, derived_type & a) noexcept
template <std::same_as<derived_type> derived_type_>
friend constexpr derived_type_ & tag_invoke(custom::assign_char_to, char_type const c, derived_type_ & a) noexcept
requires(requires {
{
a.assign_char(c)
Expand All @@ -389,39 +398,43 @@ class base<derived_type, 1ul, char_t>
}

//!\brief tag_invoke() wrapper around member.
friend constexpr bool tag_invoke(custom::char_is_valid_for, char_type const c, derived_type) noexcept
template <std::same_as<derived_type> derived_type_>
friend constexpr bool tag_invoke(custom::char_is_valid_for, char_type const c, derived_type_) noexcept
requires(requires {
{
derived_type::char_is_valid(c)
derived_type_::char_is_valid(c)
};
} && std::is_nothrow_default_constructible_v<derived_type>)
} && std::is_nothrow_default_constructible_v<derived_type_>)
{
return derived_type::char_is_valid(c);
return derived_type_::char_is_valid(c);
}

//!\brief tag_invoke() wrapper around member.
template <std::same_as<derived_type> derived_type_>
friend constexpr bool tag_invoke(custom::char_is_valid_for,
char_type const c,
std::type_identity<derived_type>) noexcept
std::type_identity<derived_type_>) noexcept
requires(requires {
{
derived_type::char_is_valid(c)
derived_type_::char_is_valid(c)
};
} && !std::is_nothrow_default_constructible_v<derived_type>)
} && !std::is_nothrow_default_constructible_v<derived_type_>)
{
return derived_type::char_is_valid(c);
return derived_type_::char_is_valid(c);
}

//!\brief tag_invoke() wrapper around member.
friend consteval auto tag_invoke(custom::size, derived_type) noexcept
requires meta::constexpr_default_initializable<derived_type>
template <std::same_as<derived_type> derived_type_>
friend consteval auto tag_invoke(custom::size, derived_type_) noexcept
requires meta::constexpr_default_initializable<derived_type_>
{
return alphabet_size;
}

//!\brief tag_invoke() wrapper around member.
friend consteval auto tag_invoke(custom::size, std::type_identity<derived_type>) noexcept
requires(!meta::constexpr_default_initializable<derived_type>)
template <std::same_as<derived_type> derived_type_>
friend consteval auto tag_invoke(custom::size, std::type_identity<derived_type_>) noexcept
requires(!meta::constexpr_default_initializable<derived_type_>)
{
return alphabet_size;
}
Expand Down
65 changes: 39 additions & 26 deletions include/bio/alphabet/proxy_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ class proxy_base
friend constexpr auto tag_invoke(custom::to_rank, derived_type const a) noexcept { return a.to_rank(); }

//!\brief tag_invoke() wrapper around member.
friend constexpr derived_type & tag_invoke(custom::assign_rank_to, auto const r, derived_type & a) noexcept
template <std::same_as<derived_type> derived_type_>
friend constexpr derived_type_ & tag_invoke(custom::assign_rank_to, auto const r, derived_type_ & a) noexcept
requires(requires {
{
a.assign_rank(r)
Expand All @@ -297,9 +298,10 @@ class proxy_base
}

//!\brief tag_invoke() wrapper around member.
friend constexpr derived_type const & tag_invoke(custom::assign_rank_to,
auto const r,
derived_type const & a) noexcept
template <std::same_as<derived_type> derived_type_>
friend constexpr derived_type_ const & tag_invoke(custom::assign_rank_to,
auto const r,
derived_type_ const & a) noexcept
requires(requires {
{
a.assign_rank(r)
Expand All @@ -310,7 +312,8 @@ class proxy_base
}

//!\brief tag_invoke() wrapper around member.
friend constexpr auto tag_invoke(custom::to_char, derived_type const a) noexcept
template <std::same_as<derived_type> derived_type_>
friend constexpr auto tag_invoke(custom::to_char, derived_type_ const a) noexcept
requires(requires {
{
a.to_char()
Expand All @@ -321,7 +324,8 @@ class proxy_base
}

//!\brief tag_invoke() wrapper around member.
friend constexpr derived_type & tag_invoke(custom::assign_char_to, char_type const c, derived_type & a) noexcept
template <std::same_as<derived_type> derived_type_>
friend constexpr derived_type_ & tag_invoke(custom::assign_char_to, char_type const c, derived_type_ & a) noexcept
requires(requires {
{
a.assign_char(c)
Expand All @@ -332,9 +336,10 @@ class proxy_base
}

//!\brief tag_invoke() wrapper around member.
friend constexpr derived_type const & tag_invoke(custom::assign_char_to,
char_type const c,
derived_type const & a) noexcept
template <std::same_as<derived_type> derived_type_>
friend constexpr derived_type_ const & tag_invoke(custom::assign_char_to,
char_type const c,
derived_type_ const & a) noexcept
requires(requires {
{
a.assign_char(c)
Expand All @@ -345,45 +350,50 @@ class proxy_base
}

//!\brief tag_invoke() wrapper around member.
friend constexpr bool tag_invoke(custom::char_is_valid_for, char_type const c, derived_type) noexcept
template <std::same_as<derived_type> derived_type_>
friend constexpr bool tag_invoke(custom::char_is_valid_for, char_type const c, derived_type_) noexcept
requires(requires {
{
derived_type::char_is_valid(c)
derived_type_::char_is_valid(c)
};
})
{
return derived_type::char_is_valid(c);
return derived_type_::char_is_valid(c);
}

//!\brief tag_invoke() wrapper around member.
template <std::same_as<derived_type> derived_type_>
friend constexpr bool tag_invoke(custom::char_is_valid_for,
char_type const c,
std::type_identity<derived_type>) noexcept
std::type_identity<derived_type_>) noexcept
requires(requires {
{
derived_type::char_is_valid(c)
derived_type_::char_is_valid(c)
};
} && !meta::constexpr_default_initializable<derived_type>)
} && !meta::constexpr_default_initializable<derived_type_>)
{
return derived_type::char_is_valid(c);
return derived_type_::char_is_valid(c);
}

//!\brief tag_invoke() wrapper around member.
friend consteval auto tag_invoke(custom::size, derived_type) noexcept
requires meta::constexpr_default_initializable<derived_type>
template <std::same_as<derived_type> derived_type_>
friend consteval auto tag_invoke(custom::size, derived_type_) noexcept
requires meta::constexpr_default_initializable<derived_type_>
{
return alphabet_size;
}

//!\brief tag_invoke() wrapper around member.
friend consteval auto tag_invoke(custom::size, std::type_identity<derived_type>) noexcept
requires(!meta::constexpr_default_initializable<derived_type>)
template <std::same_as<derived_type> derived_type_>
friend consteval auto tag_invoke(custom::size, std::type_identity<derived_type_>) noexcept
requires(!meta::constexpr_default_initializable<derived_type_>)
{
return alphabet_size;
}

//!\brief tag_invoke() wrapper around member.
friend constexpr auto tag_invoke(custom::complement, derived_type const a) noexcept
template <std::same_as<derived_type> derived_type_>
friend constexpr auto tag_invoke(custom::complement, derived_type_ const a) noexcept
requires(requires {
{
a.complement()
Expand All @@ -394,7 +404,8 @@ class proxy_base
}

//!\brief tag_invoke() wrapper around member.
friend constexpr phred_type tag_invoke(custom::to_phred, derived_type const a) noexcept
template <std::same_as<derived_type> derived_type_>
friend constexpr phred_type tag_invoke(custom::to_phred, derived_type_ const a) noexcept
requires(requires {
{
a.to_phred()
Expand All @@ -405,7 +416,8 @@ class proxy_base
}

//!\brief tag_invoke() wrapper around member.
friend constexpr derived_type & tag_invoke(custom::assign_phred_to, phred_type const p, derived_type & a) noexcept
template <std::same_as<derived_type> derived_type_>
friend constexpr derived_type_ & tag_invoke(custom::assign_phred_to, phred_type const p, derived_type_ & a) noexcept
requires(requires {
{
a.assign_phred(p)
Expand All @@ -416,9 +428,10 @@ class proxy_base
}

//!\brief tag_invoke() wrapper around member.
friend constexpr derived_type const & tag_invoke(custom::assign_phred_to,
phred_type const p,
derived_type const & a) noexcept
template <std::same_as<derived_type> derived_type_>
friend constexpr derived_type_ const & tag_invoke(custom::assign_phred_to,
phred_type const p,
derived_type_ const & a) noexcept
requires(requires {
{
a.assign_phred(p)
Expand Down
Loading

0 comments on commit d13c863

Please sign in to comment.