summaryrefslogtreecommitdiffstats
path: root/src/strong_int.hh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 04:48:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 04:48:35 +0000
commit207df6fc406e81bfeebdff7f404bd242ff3f099f (patch)
treea1a796b056909dd0a04ffec163db9363a8757808 /src/strong_int.hh
parentReleasing progress-linux version 0.11.2-1~progress7.99u1. (diff)
downloadlnav-207df6fc406e81bfeebdff7f404bd242ff3f099f.tar.xz
lnav-207df6fc406e81bfeebdff7f404bd242ff3f099f.zip
Merging upstream version 0.12.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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;