Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated readme to make library easier to understand #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,39 @@
* Conversion to and from strings!
* Output streaming!
* Really, really bad Latin! [*](#disclaimer)

## Translations ##

* ab filo = to string
* ad filum = from string
* numerus = number
* numeris romanis = roman numbers
* numeris arabicis = arabic numbers

## Functions ##

* constructor
* Takes either Arabic or Roman numerals as parameter
* numerus ab_filo(std::string_view str)
* Converts passed Roman numeral into a numerus object
* Helper function used in user-defined Roman literals
* std::string ad_filum()
* Converts numerus' value to a string of it's Roman numeral counterpart
* Printing a numerus object will display the Roman numeral


## Examples ##

```cpp
using namespace rom::literals_numerorum;
static_assert("MCMLXXXVIII"_r + "XII"_r == "MM"_r);
static_assert("MCMLXXXVIII"_r + "XII"_r == "MM"_r); // 1988 + 12 == 2000
```

```cpp
void foo()
{
std::cout << rom::numerus{742} << '\n'; // prints DCCXLII
std::cout << rom::numerus{"DCCXLII"_r} << '\n'; // prints DCCXLII
}
```

Expand All @@ -34,6 +55,15 @@ void bar()
}
```

```cpp
void bax()
{
const rom::numerus x{ "MCMLXXXVIII"_r };
const rom::numerus y{ "XII"_r };
const rom::numerus z = x + y;
std::cout << z << '\n'; // prints MM
}
```

## Acknowledgements ##

Expand Down