|
xrpld
|
A type-safe wrap around standard integral types. More...
#include <tagged_integer.h>


Public Types | |
| using | value_type = Int |
| using | tag_type = Tag |
Public Member Functions | |
| TaggedInteger ()=default | |
| template<class OtherInt> requires (std::is_integral_v<OtherInt> && sizeof(OtherInt) <= sizeof(Int)) | |
| constexpr | TaggedInteger (OtherInt value) noexcept |
| bool | operator< (TaggedInteger const &rhs) const noexcept |
| bool | operator== (TaggedInteger const &rhs) const noexcept |
| TaggedInteger & | operator+= (TaggedInteger const &rhs) noexcept |
| TaggedInteger & | operator-= (TaggedInteger const &rhs) noexcept |
| TaggedInteger & | operator*= (TaggedInteger const &rhs) noexcept |
| TaggedInteger & | operator/= (TaggedInteger const &rhs) noexcept |
| TaggedInteger & | operator%= (TaggedInteger const &rhs) noexcept |
| TaggedInteger & | operator|= (TaggedInteger const &rhs) noexcept |
| TaggedInteger & | operator&= (TaggedInteger const &rhs) noexcept |
| TaggedInteger & | operator^= (TaggedInteger const &rhs) noexcept |
| TaggedInteger & | operator<<= (TaggedInteger const &rhs) noexcept |
| TaggedInteger & | operator>>= (TaggedInteger const &rhs) noexcept |
| TaggedInteger | operator~ () const noexcept |
| TaggedInteger | operator+ () const noexcept |
| TaggedInteger | operator- () const noexcept |
| TaggedInteger & | operator++ () noexcept |
| TaggedInteger & | operator-- () noexcept |
| operator Int () const noexcept | |
Private Attributes | |
| Int | value_ |
Friends | |
| std::ostream & | operator<< (std::ostream &s, TaggedInteger const &t) |
| std::istream & | operator>> (std::istream &s, TaggedInteger &t) |
| std::string | to_string (TaggedInteger const &t) |
A type-safe wrap around standard integral types.
The tag is used to implement type safety, catching mismatched types at compile time. Multiple instantiations wrapping the same underlying integral type are distinct types (distinguished by tag) and will not interoperate. A tagged_integer supports all the usual assignment, arithmetic, comparison and shifting operations defined for the underlying type
The tag is not meant as a unit, which would require restricting the set of allowed arithmetic operations.
Definition at line 28 of file tagged_integer.h.
| using xrpl::TaggedInteger< Int, Tag >::value_type = Int |
Definition at line 42 of file tagged_integer.h.
| using xrpl::TaggedInteger< Int, Tag >::tag_type = Tag |
Definition at line 43 of file tagged_integer.h.
|
default |
|
explicitconstexprnoexcept |
Definition at line 48 of file tagged_integer.h.
|
noexcept |
Definition at line 55 of file tagged_integer.h.
|
noexcept |
Definition at line 62 of file tagged_integer.h.
|
noexcept |
Definition at line 68 of file tagged_integer.h.
|
noexcept |
Definition at line 75 of file tagged_integer.h.
|
noexcept |
Definition at line 82 of file tagged_integer.h.
|
noexcept |
Definition at line 89 of file tagged_integer.h.
|
noexcept |
Definition at line 96 of file tagged_integer.h.
|
noexcept |
Definition at line 103 of file tagged_integer.h.
|
noexcept |
Definition at line 110 of file tagged_integer.h.
|
noexcept |
Definition at line 117 of file tagged_integer.h.
|
noexcept |
Definition at line 123 of file tagged_integer.h.
|
noexcept |
Definition at line 131 of file tagged_integer.h.
|
noexcept |
Definition at line 138 of file tagged_integer.h.
|
noexcept |
Definition at line 144 of file tagged_integer.h.
|
noexcept |
Definition at line 150 of file tagged_integer.h.
|
noexcept |
Definition at line 156 of file tagged_integer.h.
|
noexcept |
Definition at line 163 of file tagged_integer.h.
|
explicitnoexcept |
Definition at line 170 of file tagged_integer.h.
|
friend |
Definition at line 175 of file tagged_integer.h.
|
friend |
Definition at line 183 of file tagged_integer.h.
|
friend |
Definition at line 190 of file tagged_integer.h.
|
private |
Definition at line 39 of file tagged_integer.h.