10 #ifndef STRONG_TYPEDEF_TYPE_HPP
11 #define STRONG_TYPEDEF_TYPE_HPP
26 template <
class T,
class Tthis>
38 constexpr Tthis &operator =(
const StrongTypedef &rhs) { this->
value = rhs.
value;
return static_cast<Tthis &
>(*this); }
39 constexpr Tthis &operator =(
StrongTypedef &&rhs) { this->
value = std::move(rhs.value);
return static_cast<Tthis &
>(*this); }
40 constexpr Tthis &operator =(
const T &rhs) { this->
value = rhs;
return static_cast<Tthis &
>(*this); }
42 explicit constexpr
operator T()
const {
return this->
value; }
46 constexpr
bool operator ==(
const T &rhs)
const {
return this->
value == rhs; }
47 constexpr
bool operator !=(
const T &rhs)
const {
return this->
value != rhs; }
55 template <
class T,
class Tthis>
59 constexpr Tthis &operator ++() { this->
value++;
return static_cast<Tthis &
>(*this); }
60 constexpr Tthis &operator --() { this->
value--;
return static_cast<Tthis &
>(*this); }
61 constexpr Tthis operator ++(
int) {
auto res =
static_cast<Tthis &
>(*this); this->
value++;
return res; }
62 constexpr Tthis operator --(
int) {
auto res =
static_cast<Tthis &
>(*this); this->
value--;
return res; }
64 constexpr Tthis &operator +=(
const Tthis &rhs) { this->
value += rhs.value;
return *
static_cast<Tthis *
>(
this); }
65 constexpr Tthis &operator -=(
const Tthis &rhs) { this->
value -= rhs.value;
return *
static_cast<Tthis *
>(
this); }
67 constexpr Tthis operator +(
const Tthis &rhs)
const {
return Tthis{ this->
value + rhs.value }; }
68 constexpr Tthis operator -(
const Tthis &rhs)
const {
return Tthis{ this->
value - rhs.value }; }
69 constexpr Tthis operator +(
const T &rhs)
const {
return Tthis{ this->
value + rhs }; }
70 constexpr Tthis operator -(
const T &rhs)
const {
return Tthis{ this->
value - rhs }; }