首次提交
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#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;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user