fixed_string: add constexpr equality operators
This fixes some errors seen under UBSan when comparing fixed_string objects in std::integral_constant under GCC. In particular the M != N case appears to be important.
This commit is contained in:
parent
7dec7b63f3
commit
a44260b8b4
@ -43,9 +43,18 @@ namespace cruft {
|
||||
|
||||
auto begin (void) const& noexcept { return std::begin (value); }
|
||||
auto end (void) const& noexcept { return std::end (value); }
|
||||
};
|
||||
|
||||
|
||||
constexpr bool
|
||||
operator== (fixed_string<N> const&) const noexcept = default;
|
||||
|
||||
template <std::size_t M>
|
||||
requires (M != N)
|
||||
constexpr bool
|
||||
operator== (fixed_string<M> const&) const noexcept
|
||||
{ return false; }
|
||||
};
|
||||
|
||||
template <std::size_t N>
|
||||
fixed_string (char const (&)[N]) -> fixed_string<N - 1>;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user