9 #ifndef TurtleBrains_TypedInteger_hpp
10 #define TurtleBrains_TypedInteger_hpp
12 #include <type_traits>
48 template<typename Type, typename std::underlying_type<Type>::type defaultValue =
typename std::underlying_type<Type>::type(0)>
struct TypedInteger
51 using Integer =
typename std::underlying_type<Type>::type;
56 constexpr
inline TypedInteger(
const Integer value = defaultValue) :
65 constexpr
inline operator Integer(
void)
const {
return Integer(mValue); }
76 inline constexpr TypedInteger::Integer
operator+(TypedInteger::Integer value)
const {
return mValue + value; }
77 inline TypedInteger::Integer operator+=(TypedInteger::Integer value) {
return mValue += value; }
78 inline TypedInteger::Integer operator++(
void) {
return ++mValue; }
79 inline TypedInteger::Integer operator++(
int) {
return mValue++; }
81 inline constexpr TypedInteger::Integer operator-(TypedInteger::Integer value)
const {
return mValue - value; }
82 inline TypedInteger::Integer operator-=(TypedInteger::Integer value) {
return mValue -= value; }
83 inline TypedInteger::Integer operator--(
void) {
return --mValue; }
84 inline TypedInteger::Integer operator--(
int) {
return mValue--; }
98 template<
typename Type>
struct std::hash<
TurtleBrains::Core::TypedInteger<Type>>
102 return std::hash<typename TurtleBrains::Core::TypedInteger<Type>::Integer>{}(value);
Contains core functionality for each component of the API.
Definition: tb_debug_logger.hpp:125
Here is some information about the primary namespace.
Definition: tb_application_dialog.hpp:22
Definition: tb_typed_integer.hpp:49
constexpr TypedInteger(const Integer value=defaultValue)
Definition: tb_typed_integer.hpp:56
constexpr TypedInteger::Integer operator+(TypedInteger::Integer value) const
Definition: tb_typed_integer.hpp:76