1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#include <ctll/fixed_string.hpp>
void empty_symbol() { }
static constexpr auto Pattern = ctll::fixed_string{ LR"(^\s*(\d+)\s+:(\S):$(\S+?)$(\S+?)$(\S+))" };
static_assert(Pattern.size() == 38);
// ordinary string is taken as array of bytes
#ifdef CTRE_STRING_IS_UTF8
static_assert(ctll::fixed_string("ฤลกฤ").size() == 3);
static_assert(ctll::fixed_string("๐").size() == 1);
static_assert(ctll::fixed_string("๐")[0] == L'๐');
#else
static_assert(ctll::fixed_string("ฤลกฤ").size() == 6); // it's just a bunch of bytes
static_assert(ctll::fixed_string("๐").size() == 4); // it's just a bunch of bytes
#endif
#if __cpp_char8_t
// u8"" is utf-8 encoded
static_assert(ctll::fixed_string(u8"ฤลกฤ").size() == 3);
static_assert(ctll::fixed_string(u8"๐").size() == 1);
static_assert(ctll::fixed_string(u8"๐")[0] == U'๐');
#endif
// u"" is utf-16
static_assert(ctll::fixed_string(u"ฤลกฤ").size() == 3);
static_assert(ctll::fixed_string(u"๐").size() == 1);
static_assert(ctll::fixed_string(u"๐").is_same_as(ctll::fixed_string(U"๐")));
// U"" is utf-32
static_assert(ctll::fixed_string(U"ฤลกฤ").size() == 3);
static_assert(ctll::fixed_string(U"๐").size() == 1);
// everything is converted into utf-32
|