Skip to content

cppden/ctstring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status license

ctstring

Compile-Time String

Strings at compile-time

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)), "");

Obfuscated strings

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;