项目作者: cppden

项目描述 :
Compile-Time String
高级语言: C++
项目地址: git://github.com/cppden/ctstring.git
创建时间: 2016-12-25T14:35:40Z
项目社区:https://github.com/cppden/ctstring

开源协议:MIT License

下载


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:

  1. auto sample1 = "Hello"_chars;
  2. auto sample2 = "Hello"_ichars;
  3. char constexpr csz[] = "hello world";
  4. static_assert(!sample1.match(csz, csz+sizeof(csz)), "");
  5. static_assert(sample2.match(csz, csz+sizeof(csz)), "");

Obfuscated strings

Obfuscate strings in compiled binary to hide sensitive data:

  1. auto const xsHidden = "Farewell: this won't be seen in binary!"_xchars;
  2. std::cout << "hidden: " << xsHidden.str().c_str() << std::endl;