24 static constexpr size_t size = Size;
26 operator std::string_view()
const {
return std::string_view{buf.data(), Size - 1}; }
28 constexpr CompTimeString() { }
29 constexpr CompTimeString(
const char (&buf_)[Size])
31 for (
size_t i = 0; i < Size; ++i)
36 constexpr CompTimeString(
const std::array<char, Size> & buf_)
38 for (
size_t i = 0; i < Size; ++i)
44 template<
size_t Other>
45 constexpr CompTimeString<Size - 1 + Other>
46 operator+(
const CompTimeString<Other> & other)
const
48 CompTimeString<Size - 1 + Other> ret{};
49 auto it = std::data(ret.buf);
50 it = std::copy_n(std::data(buf), Size - 1, it);
51 it = std::copy_n(std::data(other.buf), Other - 1, it);
52 ret.buf[
decltype(ret)::size - 1] = 0;
56 template<
size_t Other>
57 constexpr CompTimeString<Size - 1 + Other + 2>
58 operator,(
const CompTimeString<Other> & other)
const
60 CompTimeString<Size - 1 + Other + 2 > ret{};
61 auto it = std::data(ret.buf);
62 it = std::copy_n(std::data(buf), Size - 1, it);
63 it = std::copy_n(std::data(
", "), 2, it);
64 it = std::copy_n(std::data(other.buf), Other - 1, it);
65 ret.buf[
decltype(ret)::size - 1] = 0;
69 std::array<char, Size> buf;