Skip to content

Latest commit

 

History

History
30 lines (24 loc) · 967 Bytes

README.md

File metadata and controls

30 lines (24 loc) · 967 Bytes

RadixLiteral

RadixLiteral is header-only library implementing custom numeral system literal suffixes.

Usage

For example usage and build tests run compile script:

./compile

It will build RadixLiteral and RadixLiteral_clang binaries (for g++ and Clang respectively). You can make use of appending -g flag to the command for builing debug target.

For use in client application - include the src/RadixLiteral.h header to your project and define the numeral system you want to use in your literals by defining following macro:

NUMERAL_SYSTEM(numeral_system_base);

For example for base-4 numeric system literals:

NUMERAL_SYSTEM(4);

Then you can use custom numeric system literals in your code, for example:

312_b4 

For past 10-based numeral systems there is a limitation - you'll need to surround the desired value with quotation marks "", similarly like when defining a string, for example:

"3A1"_15