summaryrefslogtreecommitdiffstats
path: root/src/strong_int.hh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/strong_int.hh32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/strong_int.hh b/src/strong_int.hh
index af18da9..36c0503 100644
--- a/src/strong_int.hh
+++ b/src/strong_int.hh
@@ -45,59 +45,55 @@ template<typename T, class DISTINCT>
class strong_int {
public:
explicit constexpr strong_int(T v = 0) noexcept : value(v){};
- operator const T&() const
- {
- return this->value;
- };
+ operator const T&() const { return this->value; }
strong_int operator+(const strong_int& rhs) const
{
return strong_int(this->value + rhs.value);
- };
+ }
strong_int operator-(const strong_int& rhs) const
{
return strong_int(this->value - rhs.value);
- };
+ }
strong_int operator/(const strong_int& rhs) const
{
return strong_int(this->value / rhs.value);
- };
+ }
bool operator<(const strong_int& rhs) const
{
return this->value < rhs.value;
- };
+ }
strong_int& operator+=(const strong_int& rhs)
{
this->value += rhs.value;
return *this;
- };
+ }
strong_int& operator-=(const strong_int& rhs)
{
this->value -= rhs.value;
return *this;
- };
+ }
strong_int& operator-()
{
this->value = -this->value;
return *this;
- };
+ }
strong_int& operator++()
{
this->value++;
return *this;
- };
+ }
strong_int& operator--()
{
this->value--;
return *this;
- };
+ }
bool operator==(const strong_int& rhs) const
{
return this->value == rhs.value;
- };
- T* out()
- {
- return &this->value;
- };
+ }
+ T* out() { return &this->value; }
+
+ T& lvalue() { return this->value; }
private:
T value;