numeris_romanis.hpp
is a single-header C++17 library for dealing with roman numerals.
- Literal operators so you too can embed film copyright dates in your source code!
- Seamless interoperability with numeris arabicis!
- Type safety!
- Compile-time operations!
- Conversion to and from strings!
- Output streaming!
- Really, really bad Latin! *
using namespace rom::literals_numerorum;
static_assert("MCMLXXXVIII"_r + "XII"_r == "MM"_r);
void foo()
{
std::cout << rom::numerus{742} << '\n'; // prints DCCXLII
}
void bar()
{
const rom::numerus r{444};
std::string str = r.ad_filum();
assert(str == "CDXLIV");
}
Inspired by Tim Sweeney on Twitter:
Breaking: Roman numeral constant support proposed for C++0rMMXXIII.
— Tim Sweeney (@TimSweeneyEpic) October 4, 2018
*: All translations provided by Google Translate. Please don't make me write it out a hundred times.