1#ifndef CODEX_LUA_UTILS_H
2#define CODEX_LUA_UTILS_H
10#define FWD(x) std::forward<decltype(x)>(x)
12template<std::
size_t N>
16 constexpr operator std::string_view(
void)
const {
return {this->
s,
N}; }
17 constexpr std::size_t
size(
void)
const {
return N; }
18 constexpr const char *
data(
void)
const {
return this->
s; }
19 constexpr const char *
begin(
void)
const {
return this->
s; }
20 constexpr const char *
end(
void)
const {
return this->
s +
N; }
21 constexpr char *
begin(
void) {
return this->
s; }
22 constexpr char *
end(
void) {
return this->
s +
N; }
26template<
typename ...Ts>
struct types;
31template<
typename T,
typename ...Ts>
32auto front(std::tuple<T, Ts...>) ->
T;
34template<
typename T,
typename ...Ts>
37template<
typename ...Ts>
45template<std::
size_t N>
48template<std::
size_t N>
50 std::copy(s_, s_ +
N, this->
s);
53template<std::
size_t N0, std::
size_t N1>
56 std::copy(s0.
begin(), s0.
end(), ret.begin());
57 std::copy(s1.
begin(), s1.
end(), ret.begin() + N0);
61template<fixed_
string s, std::
size_t b, std::
size_t e>
63 constexpr explicit operator std::string_view(
void)
const;
66template<fixed_
string s, std::
size_t b, std::
size_t e>
68 return std::string_view{
s}.substr(
b, e -
b);
74constexpr auto slice(std::string_view
s, std::size_t
b, std::size_t e) {
75 return std::string_view{
76 begin(
s) + std::min(
b,
s.
size()),
77 begin(
s) + std::min(e,
s.
size()),
#define f(x)
Definition 5.c:2
#define T(f, T, C)
Definition bench.cpp:136
#define x
Definition gcc14.c:1
#define N
Definition queue_atomic.c:4
codex::refl::field_tuple_t< E > T
Definition soa.cpp:9
char s[N]
Definition utils.hpp:23
constexpr char * end(void)
Definition utils.hpp:22
constexpr const char * data(void) const
Definition utils.hpp:18
constexpr fixed_string(void)=default
constexpr char * begin(void)
Definition utils.hpp:21
constexpr const char * end(void) const
Definition utils.hpp:20
constexpr const char * begin(void) const
Definition utils.hpp:19
constexpr std::size_t size(void) const
Definition utils.hpp:17
decltype(::front(std::tuple< Ts... >{})) front
Definition utils.hpp:39
decltype(::pop_front(std::tuple< Ts... >{})) pop_front
Definition utils.hpp:41
static constexpr void for_each(auto &&f)
Definition utils.hpp:42
constexpr fixed_string s
Definition test.cpp:6
fixed_string(const char(&)[N]) -> fixed_string< N - 1 >
constexpr auto operator+(fixed_string< N0 > s0, fixed_string< N1 > s1)
Definition utils.hpp:54
#define FWD(x)
Definition utils.hpp:10
auto front(std::tuple<>) -> types<>
auto pop_front(std::tuple<>) -> types<>
std::integral_constant< decltype(x), x > constant
Definition utils.hpp:72
constexpr auto slice(std::string_view s, std::size_t b, std::size_t e)
Definition utils.hpp:74