Compile-Time String
Strings can be used for anything at compile-time, e.g. for hash calculation or matching:
auto sample1 = "Hello"_chars;
auto sample2 = "Hello"_ichars;
char constexpr csz[] = "hello world";
static_assert(!sample1.match(csz, csz+sizeof(csz)), "");
static_assert(sample2.match(csz, csz+sizeof(csz)), "");
Obfuscate strings in compiled binary to hide sensitive data:
auto const xsHidden = "Farewell: this won't be seen in binary!"_xchars;
std::cout << "hidden: " << xsHidden.str().c_str() << std::endl;