Skip to content

An entirely const_expr string class in C++. Similar to string_view, most useful for compile-time constants

License

Notifications You must be signed in to change notification settings

erichkeane/const_expr_string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

const_expr_string

An entirely const_expr string class in C++. Similar to string_view, most useful for compile-time constants

This header-only class is meant to be an entirely compile-time string wrapper, specifically as a replacement for static-const char and #define X string constants.

It emulates string_view as close as possible.

Compatible with C++14 AND C++11 (though separate implementations for each for a few functions). Tested on G++4.9 and 5.2, and clang++ 3.5 and 3.6.1.

To compile the main test, just do one of the following:

g++ -std=c++14 -O3 -Wextra -Wall -Werror main.cpp
g++ -std=c++11 -O3 -Wextra -Wall -Werror main.cpp
clang++ -std=c++14 -O3 -Wextra -Wall -Werror main.cpp
clang++ -std=c++11 -O3 -Wextra -Wall -Werror main.cpp

Or, if you have CMake:

mkdir build
cd build
cmake ..
make

This will produce a binary called main in build/bin/.

About

An entirely const_expr string class in C++. Similar to string_view, most useful for compile-time constants

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published