diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-08-23 23:56:35 +0200 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-08-23 23:56:35 +0200 |
| commit | e4fd839ddaaf3fc68df2cb502a633a2ae6a9f86f (patch) | |
| tree | 681b2a63eb9b9497b97697e3f1479a7b20270427 /src/units.hh | |
| parent | 0d8cce272831cd896d0e69d7c86cc9afc521eb11 (diff) | |
use a strongly typed int CharCount for character counts
Diffstat (limited to 'src/units.hh')
| -rw-r--r-- | src/units.hh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/units.hh b/src/units.hh index 8a1180de..ca9eb39a 100644 --- a/src/units.hh +++ b/src/units.hh @@ -67,6 +67,9 @@ public: bool operator>=(const RealType& other) const { return m_value >= other.m_value; } + bool operator!() const + { return !m_value; } + explicit operator ValueType() const { return m_value; } private: ValueType m_value; @@ -82,6 +85,16 @@ inline LineCount operator"" _line(unsigned long long int value) return LineCount(value); } +struct CharCount : public StronglyTypedInteger<CharCount, int> +{ + CharCount(int value) : StronglyTypedInteger<CharCount>(value) {} +}; + +inline CharCount operator"" _char(unsigned long long int value) +{ + return CharCount(value); +} + } #endif // units_hh_INCLUDED |
