Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 

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.

About

Roman numeral support for C++17

Topics

Resources

Releases

No releases published

Packages

No packages published

Languages