Flatstring Functions
#include <xo/flatstring/flatstring.hpp>
-
template<typename ...Ts>
constexpr auto xo::flatstring_concat(Ts&&... args) noexcept Concatenate flatstrings, possibly mixed with C-style char arrays.
Example:
constexpr auto s = flatstring_concat(flatstring("hello"), ", ", flatstring("world")); static_assert(s.capacity == 13);
-
template<std::size_t N1, std::size_t N2>
constexpr auto operator<=>(const flatstring<N1> &s1, const flatstring<N2> &s2) noexcept 3-way compare for two flatstrings
Example
constexpr auto cmp = (flatstring("foo") <=> flatstring("bar")); static_assert(cmp != 0);
-
template<std::size_t N1, std::size_t N2>
constexpr bool operator==(const flatstring<N1> &s1, const flatstring<N2> &s2) noexcept equality comparison for two flatstrings.
Example
constexpr bool cmp = (flatstring("foo") == flatstring("foo")); static_assert(cmp == true);
Note
spaceship operator alone isn’t sufficient to get this defined, at least with gcc 13.1