fixed_string: add value_type and begin/end

This commit is contained in:
Danny Robson 2024-07-25 10:18:07 +10:00
parent 0a7cd59eb9
commit 02e2262d0a

View File

@ -21,6 +21,8 @@ namespace cruft {
/// extensions). /// extensions).
template <std::size_t N> template <std::size_t N>
struct fixed_string { struct fixed_string {
using value_type = char;
char value[N + 1] {}; char value[N + 1] {};
static std::size_t size (void) { return N; } static std::size_t size (void) { return N; }
@ -37,6 +39,9 @@ namespace cruft {
constexpr char const* constexpr char const*
c_str (void) const noexcept c_str (void) const noexcept
{ return value; } { return value; }
auto begin (void) const& noexcept { return std::begin (value); }
auto end (void) const& noexcept { return std::end (value); }
}; };