48 Value(T initial) : _v(initial) {}
51 float put(
float x)
override { _v = Codec::fromFloat(x);
return x; }
52 float get()
override {
return Codec::toFloat(_v); }
55 inline T value()
const {
return _v; }
56 inline void value(T v) { _v = v; }
59 inline operator T()
const {
return _v; }
62 inline Value& operator=(T v) { _v = v;
return *
this; }
65 inline Value& operator++() { ++_v;
return *
this; }
66 inline Value& operator--() { --_v;
return *
this; }
69 inline T operator++(
int) { T old = _v; ++_v;
return old; }
70 inline T operator--(
int) { T old = _v; --_v;
return old; }
73 inline T operator-()
const {
return -_v; }
76 inline Value& operator+=(T rhs) { _v += rhs;
return *
this; }
77 inline Value& operator-=(T rhs) { _v -= rhs;
return *
this; }
78 inline Value& operator*=(T rhs) { _v *= rhs;
return *
this; }
79 inline Value& operator/=(T rhs) { _v /= rhs;
return *
this; }
82 inline Value& operator+=(
const Value& rhs) { _v += rhs._v;
return *
this; }
83 inline Value& operator-=(
const Value& rhs) { _v -= rhs._v;
return *
this; }
84 inline Value& operator*=(
const Value& rhs) { _v *= rhs._v;
return *
this; }
85 inline Value& operator/=(
const Value& rhs) { _v /= rhs._v;
return *
this; }
88 template <
typename U = T>
89 inline enable_if_t<supports_modulo<U>::value, Value&>
90 operator%=(U rhs) { _v %= rhs;
return *
this; }
92 template <
typename U = T>
93 inline enable_if_t<supports_modulo<U>::value, Value&>
94 operator%=(
const Value& rhs) { _v %= rhs._v;
return *
this; }
97 friend inline bool operator==(
const Value& a,
const Value& b) {
return a._v == b._v; }
98 friend inline bool operator!=(
const Value& a,
const Value& b) {
return a._v != b._v; }
99 friend inline bool operator< (
const Value& a,
const Value& b) {
return a._v < b._v; }
100 friend inline bool operator<=(
const Value& a,
const Value& b) {
return a._v <= b._v; }
101 friend inline bool operator> (
const Value& a,
const Value& b) {
return a._v > b._v; }
102 friend inline bool operator>=(
const Value& a,
const Value& b) {
return a._v >= b._v; }
104 friend inline bool operator==(
const Value& a, T b) {
return a._v == b; }
105 friend inline bool operator==(T a,
const Value& b) {
return a == b._v; }
106 friend inline bool operator!=(
const Value& a, T b) {
return a._v != b; }
107 friend inline bool operator!=(T a,
const Value& b) {
return a != b._v; }
108 friend inline bool operator< (
const Value& a, T b) {
return a._v < b; }
109 friend inline bool operator< (T a,
const Value& b) {
return a < b._v; }
110 friend inline bool operator<=(
const Value& a, T b) {
return a._v <= b; }
111 friend inline bool operator<=(T a,
const Value& b) {
return a <= b._v; }
112 friend inline bool operator> (
const Value& a, T b) {
return a._v > b; }
113 friend inline bool operator> (T a,
const Value& b) {
return a > b._v; }
114 friend inline bool operator>=(
const Value& a, T b) {
return a._v >= b; }
115 friend inline bool operator>=(T a,
const Value& b) {
return a >= b._v; }
118 friend inline T operator+(
const Value& a,
const Value& b) {
return a._v + b._v; }
119 friend inline T operator-(
const Value& a,
const Value& b) {
return a._v - b._v; }
120 friend inline T operator*(
const Value& a,
const Value& b) {
return a._v * b._v; }
121 friend inline T operator/(
const Value& a,
const Value& b) {
return a._v / b._v; }
123 friend inline T operator+(
const Value& a, T b) {
return a._v + b; }
124 friend inline T operator+(T a,
const Value& b) {
return a + b._v; }
125 friend inline T operator-(
const Value& a, T b) {
return a._v - b; }
126 friend inline T operator-(T a,
const Value& b) {
return a - b._v; }
127 friend inline T operator*(
const Value& a, T b) {
return a._v * b; }
128 friend inline T operator*(T a,
const Value& b) {
return a * b._v; }
129 friend inline T operator/(
const Value& a, T b) {
return a._v / b; }
130 friend inline T operator/(T a,
const Value& b) {
return a / b._v; }
133 template <
typename U = T>
134 friend inline enable_if_t<supports_modulo<U>::value, U>
135 operator%(
const Value& a,
const Value& b) {
return a._v % b._v; }
137 template <
typename U = T>
138 friend inline enable_if_t<supports_modulo<U>::value, U>
139 operator%(
const Value& a, U b) {
return a._v % b; }
141 template <
typename U = T>
142 friend inline enable_if_t<supports_modulo<U>::value, U>
143 operator%(U a,
const Value& b) {
return a % b._v; }