Skip to content

tcbrindle/numeris_romanis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

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.

Releases

No releases published

Packages

No packages published

Languages