52template <
typename T,
typename UNIQUE_ENUM_CLASS>
60 __attribute__((always_inline))
constexpr TTL_StrongType(T value) : value(value) {}
63 __attribute__((always_inline))
constexpr T
Underlying()
const {
121 return current_value;
148 return current_value;
201 return value / rhs.value;
231 return value > rhs.value;
240 return value >= rhs.value;
249 return value < rhs.value;
258 return value <= rhs.value;
267 return value == rhs.value;
276 return value != rhs.value;
284 template <
typename U>
286 return os << ttl_string_type.value;
297 static constexpr UNIQUE_ENUM_CLASS unique = UNIQUE_ENUM_CLASS(0);
317template <
typename TARGET_TYPE,
typename SOURCE_TYPE, u
int32_t CONVERSION_MULTIPLY, u
int32_t CONVERSION_DIVISION>
320 : TARGET_TYPE(CONVERSION_MULTIPLY == 1 ? source_value.Underlying() / CONVERSION_DIVISION
321 : source_value.Underlying() * CONVERSION_MULTIPLY) {
322 static_assert((CONVERSION_MULTIPLY == 1) || (CONVERSION_DIVISION == 1),
323 "StrongTypeConversion must have one of the conversion parameters set to 1");
326 operator TARGET_TYPE()
const {
327 return TARGET_TYPE::Underlying();
StrongTypeConversion(SOURCE_TYPE source_value)
constexpr TTL_StrongType operator+(TTL_StrongType const &rhs) const
constexpr bool operator<(TTL_StrongType const &rhs) const
constexpr T Underlying() const
constexpr TTL_StrongType operator%(TTL_StrongType rhs) const
constexpr TTL_StrongType(T value)
constexpr TTL_StrongType operator-(TTL_StrongType const &rhs) const
constexpr TTL_StrongType operator*(T rhs) const
TTL_StrongType & operator++()
constexpr TTL_StrongType operator%(T rhs) const
constexpr bool operator!=(TTL_StrongType const &rhs) const
constexpr bool operator<=(TTL_StrongType const &rhs) const
constexpr TTL_StrongType operator/(T rhs) const
constexpr bool operator>(TTL_StrongType const &rhs) const
TTL_StrongType & operator--()
constexpr TTL_StrongType operator-() const
constexpr TTL_StrongType()
constexpr bool operator==(TTL_StrongType const &rhs) const
TTL_StrongType operator++(int)
TTL_StrongType operator--(int)
T Type
Allow compile time access to the underling type, this can be useful for template parameters etc.
constexpr TTL_StrongType & operator+=(TTL_StrongType const &rhs)
constexpr bool operator>=(TTL_StrongType const &rhs) const
constexpr TTL_StrongType & operator-=(TTL_StrongType const &rhs)
constexpr T operator/(TTL_StrongType rhs) const
friend U & operator<<(U &os, const TTL_StrongType ttl_string_type)