1#ifndef NNGN_UTILS_FIXED_STRING_H
2#define NNGN_UTILS_FIXED_STRING_H
13template<std::
size_t N>
18 constexpr operator std::string_view(
void)
const {
return {this->
s,
N}; }
19 constexpr std::size_t
size(
void)
const {
return N; }
20 constexpr const char *
data(
void)
const {
return this->
s; }
21 constexpr const char *
begin(
void)
const {
return this->
s; }
22 constexpr const char *
end(
void)
const {
return this->
s +
N; }
25static_assert(std::ranges::contiguous_range<fixed_string<1>>);
27template<std::
size_t N>
30template<std::
size_t N>
32 std::copy(s_, s_ +
N, this->
s);
36template<std::ranges::sized_range ...Rs>
37constexpr auto cat(
const Rs &...rs) {
38 using T = std::common_type_t<std::ranges::range_value_t<Rs>...>;
39 constexpr auto n = (... + std::tuple_size_v<Rs>);
40 std::array<T, n> ret = {};
42 (..., (std::copy(
begin(rs),
end(rs), &ret[
i]),
i += rs.size()));
51struct tuple_size<
nngn::fixed_string<N>> : integral_constant<size_t, N> {};
function DEMO text end
Definition demo0.lua:6
for i
Definition font.lua:5
local n
Definition dump_lights.lua:5
local N
Definition gamma.lua:5
constexpr const R * begin(const T< R > &v)
Definition vec.h:207
constexpr auto cat(const Rs &...rs)
Concatenates multiple fixed_string objects into a character array.
Definition fixed_string.h:37
fixed_string(const char(&)[N]) -> fixed_string< N - 1 >
#define NNGN_DEFAULT_CONSTRUCT(x)
Definition utils.h:20
Definition fixed_string.h:14
constexpr const char * end(void) const
Definition fixed_string.h:22
char s[N]
Definition fixed_string.h:23
constexpr const char * data(void) const
Definition fixed_string.h:20
constexpr const char * begin(void) const
Definition fixed_string.h:21
constexpr std::size_t size(void) const
Definition fixed_string.h:19
constexpr ~fixed_string(void)=default
std::chrono::seconds s
Definition timing.cpp:6