19 lines
448 B
C++
19 lines
448 B
C++
#pragma once
|
|
#include <cstddef>
|
|
#include <string_view>
|
|
namespace structive {
|
|
template <std::size_t N>
|
|
struct Fixed_String {
|
|
char value[N]{};
|
|
consteval Fixed_String(const char (&text)[N]) {
|
|
for (std::size_t i = 0; i < N; ++i) {
|
|
value[i] = text[i];
|
|
}
|
|
}
|
|
constexpr std::string_view view() const {
|
|
return {value, N - 1};
|
|
}
|
|
constexpr auto operator<=>(const Fixed_String&) const = default;
|
|
};
|
|
}
|