Skip to content
Roman numeral support for C++17
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md Initial commit Jun 6, 2019
numeris_romanis.hpp "'From string'? That's motion away from, isn't it boy?" Jun 7, 2019
test_numeris_romanis.cpp Initial commit Jun 6, 2019

README.md

numeris_romanis.hpp is a single-header C++17 library for dealing with roman numerals.

Features

  • 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! *

Examples

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

Acknowledgements

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.

You can’t perform that action at this time.