From 97d550d844f6e9f336e9bf2519fae9906396d3e7 Mon Sep 17 00:00:00 2001
From: Hannes Hauswedell
Date: Fri, 21 Jul 2023 14:41:21 +0000
Subject: [PATCH] [fix] build on GCC13
---
include/bio/alphabet/base.hpp | 69 +++++++++++--------
include/bio/alphabet/proxy_base.hpp | 65 ++++++++++-------
.../ranges/detail/inherited_iterator_base.hpp | 48 ++++++-------
3 files changed, 105 insertions(+), 77 deletions(-)
diff --git a/include/bio/alphabet/base.hpp b/include/bio/alphabet/base.hpp
index 99ce7428..0e5c8ad0 100644
--- a/include/bio/alphabet/base.hpp
+++ b/include/bio/alphabet/base.hpp
@@ -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 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)
@@ -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 derived_type_>
+ friend constexpr auto tag_invoke(custom::to_char, derived_type_ const a) noexcept
requires(requires {
{
a.to_char()
@@ -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 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)
@@ -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 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 derived_type_>
friend constexpr bool tag_invoke(custom::char_is_valid_for,
char_type const c,
- std::type_identity) noexcept
+ std::type_identity) noexcept
requires(requires {
{
- derived_type::char_is_valid(c)
+ derived_type_::char_is_valid(c)
};
- } && !meta::constexpr_default_initializable)
+ } && !meta::constexpr_default_initializable)
{
- 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
+ template derived_type_>
+ friend consteval auto tag_invoke(custom::size, derived_type_) noexcept
+ requires meta::constexpr_default_initializable
{
return size;
}
//!\brief tag_invoke() wrapper around member.
- friend consteval auto tag_invoke(custom::size, std::type_identity) noexcept
- requires(!meta::constexpr_default_initializable)
+ template derived_type_>
+ friend consteval auto tag_invoke(custom::size, std::type_identity) noexcept
+ requires(!meta::constexpr_default_initializable)
{
return size;
}
@@ -367,7 +374,8 @@ class base
}
//!\brief tag_invoke() wrapper around member.
- friend constexpr auto tag_invoke(custom::to_char, derived_type const a) noexcept
+ template derived_type_>
+ friend constexpr auto tag_invoke(custom::to_char, derived_type_ const a) noexcept
requires(requires {
{
a.to_char()
@@ -378,7 +386,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 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)
@@ -389,39 +398,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 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)
+ } && std::is_nothrow_default_constructible_v)
{
- return derived_type::char_is_valid(c);
+ return derived_type_::char_is_valid(c);
}
//!\brief tag_invoke() wrapper around member.
+ template derived_type_>
friend constexpr bool tag_invoke(custom::char_is_valid_for,
char_type const c,
- std::type_identity) noexcept
+ std::type_identity) noexcept
requires(requires {
{
- derived_type::char_is_valid(c)
+ derived_type_::char_is_valid(c)
};
- } && !std::is_nothrow_default_constructible_v)
+ } && !std::is_nothrow_default_constructible_v)
{
- 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
+ template derived_type_>
+ friend consteval auto tag_invoke(custom::size, derived_type_) noexcept
+ requires meta::constexpr_default_initializable
{
return alphabet_size;
}
//!\brief tag_invoke() wrapper around member.
- friend consteval auto tag_invoke(custom::size, std::type_identity) noexcept
- requires(!meta::constexpr_default_initializable)
+ template derived_type_>
+ friend consteval auto tag_invoke(custom::size, std::type_identity) noexcept
+ requires(!meta::constexpr_default_initializable)
{
return alphabet_size;
}
diff --git a/include/bio/alphabet/proxy_base.hpp b/include/bio/alphabet/proxy_base.hpp
index f7f7791e..52faf48d 100644
--- a/include/bio/alphabet/proxy_base.hpp
+++ b/include/bio/alphabet/proxy_base.hpp
@@ -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 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)
@@ -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 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)
@@ -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 derived_type_>
+ friend constexpr auto tag_invoke(custom::to_char, derived_type_ const a) noexcept
requires(requires {
{
a.to_char()
@@ -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 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)
@@ -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 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)
@@ -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 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 derived_type_>
friend constexpr bool tag_invoke(custom::char_is_valid_for,
char_type const c,
- std::type_identity) noexcept
+ std::type_identity) noexcept
requires(requires {
{
- derived_type::char_is_valid(c)
+ derived_type_::char_is_valid(c)
};
- } && !meta::constexpr_default_initializable)
+ } && !meta::constexpr_default_initializable)
{
- 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
+ template derived_type_>
+ friend consteval auto tag_invoke(custom::size, derived_type_) noexcept
+ requires meta::constexpr_default_initializable
{
return alphabet_size;
}
//!\brief tag_invoke() wrapper around member.
- friend consteval auto tag_invoke(custom::size, std::type_identity) noexcept
- requires(!meta::constexpr_default_initializable)
+ template derived_type_>
+ friend consteval auto tag_invoke(custom::size, std::type_identity) noexcept
+ requires(!meta::constexpr_default_initializable)
{
return alphabet_size;
}
//!\brief tag_invoke() wrapper around member.
- friend constexpr auto tag_invoke(custom::complement, derived_type const a) noexcept
+ template derived_type_>
+ friend constexpr auto tag_invoke(custom::complement, derived_type_ const a) noexcept
requires(requires {
{
a.complement()
@@ -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 derived_type_>
+ friend constexpr phred_type tag_invoke(custom::to_phred, derived_type_ const a) noexcept
requires(requires {
{
a.to_phred()
@@ -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 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)
@@ -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 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)
diff --git a/include/bio/ranges/detail/inherited_iterator_base.hpp b/include/bio/ranges/detail/inherited_iterator_base.hpp
index 5c9f1df7..d5d34a54 100644
--- a/include/bio/ranges/detail/inherited_iterator_base.hpp
+++ b/include/bio/ranges/detail/inherited_iterator_base.hpp
@@ -185,17 +185,17 @@ class inherited_iterator_base :
//!\brief Post-increment, return previous iterator state.
//!\cond
- template
+ template derived_t_ = derived_t>
//!\endcond
- constexpr derived_t operator++(int) noexcept(
- noexcept(std::declval()++) && noexcept(derived_t(std::declval())))
+ constexpr derived_t_ operator++(int) noexcept(
+ noexcept(std::declval()++) && noexcept(derived_t_(std::declval())))
//!\cond
requires(requires(base_t_ i) {
i++;
{
i++
} -> std::same_as;
- } && std::constructible_from)
+ } && std::constructible_from)
//!\endcond
{
return derived_t{(*this_to_base())++};
@@ -214,13 +214,13 @@ class inherited_iterator_base :
//!\brief Post-decrement, return previous iterator state.
//!\cond
- template
+ template derived_t_ = derived_t>
//!\endcond
- constexpr derived_t operator--(int) noexcept(
- noexcept(std::declval()--) && noexcept(derived_t{std::declval()}))
- requires(requires(base_t_ i) { i--; } && std::constructible_from)
+ constexpr derived_t_ operator--(int) noexcept(
+ noexcept(std::declval()--) && noexcept(derived_t_{std::declval()}))
+ requires(requires(base_t_ i) { i--; } && std::constructible_from)
{
- return derived_t{(*this_to_base())--};
+ return derived_t_{(*this_to_base())--};
}
//!\brief Move iterator to the right.
@@ -236,23 +236,24 @@ class inherited_iterator_base :
//!\brief Returns an iterator which is advanced by `skip` positions.
//!\cond
- template
+ template derived_t_ = derived_t>
//!\endcond
- constexpr derived_t operator+(difference_type const skip) const
- noexcept(noexcept(std::declval() + skip) && noexcept(derived_t{std::declval()}))
+ constexpr derived_t_ operator+(difference_type const skip) const
+ noexcept(noexcept(std::declval() + skip) && noexcept(derived_t_{std::declval()}))
requires(requires(base_t_ const i, difference_type const n) { i + n; } &&
- std::constructible_from)
+ std::constructible_from)
{
- return derived_t{*this_to_base() + skip};
+ return derived_t_{*this_to_base() + skip};
}
//!\brief Non-member operator+ delegates to non-friend operator+.
- constexpr friend derived_t operator+(difference_type const skip,
- derived_t const & it) noexcept(noexcept(skip + std::declval()))
+ template derived_t_ = derived_t>
+ constexpr friend derived_t_ operator+(difference_type const skip, derived_t_ const & it) noexcept(
+ noexcept(skip + std::declval()))
requires(requires(base_t const i, difference_type const n) { n + i; } &&
- std::constructible_from)
+ std::constructible_from)
{
- return derived_t{skip + static_cast(it)};
+ return derived_t_{skip + static_cast(it)};
}
//!\brief Decrement iterator by skip.
@@ -268,13 +269,14 @@ class inherited_iterator_base :
//!\brief Return decremented copy of this iterator.
//!\cond
- template
+ template derived_t_ = derived_t>
//!\endcond
- constexpr derived_t operator-(difference_type const skip) const
- noexcept(noexcept(std::declval() - skip) && noexcept(derived_t(std::declval())))
- requires(requires(base_t_ i, difference_type const n) { i - n; } && std::constructible_from)
+ constexpr derived_t_ operator-(difference_type const skip) const
+ noexcept(noexcept(std::declval() - skip) && noexcept(derived_t_(std::declval())))
+ requires(requires(base_t_ i, difference_type const n) { i - n; } &&
+ std::constructible_from)
{
- return derived_t{*this_to_base() - skip};
+ return derived_t_{*this_to_base() - skip};
}
//!\brief Return offset between this and remote iterator's position.