8#ifndef ADOBE_ENUM_OPS_HPP
9#define ADOBE_ENUM_OPS_HPP
67namespace implementation {
71#if !defined(ADOBE_NO_DOCUMENTATION)
75constexpr bool has_enabled_arithmetic =
90#define ADOBE_DEFINE_BITSET_OPS(EnumType) \
91 constexpr auto adobe_enable_bitmask_enum(EnumType)->std::true_type;
96 -> std::enable_if_t<adobe::implementation::has_enabled_bitmask<T>, T> {
97 using underlying = std::underlying_type_t<T>;
98 return static_cast<T
>(
static_cast<underlying
>(lhs) &
static_cast<underlying
>(rhs));
103 -> std::enable_if_t<adobe::implementation::has_enabled_bitmask<T>, T> {
104 using underlying = std::underlying_type_t<T>;
105 return static_cast<T
>(~static_cast<underlying>(a));
110 -> std::enable_if_t<adobe::implementation::has_enabled_bitmask<T>, T> {
111 using underlying = std::underlying_type_t<T>;
112 return static_cast<T
>(
static_cast<underlying
>(lhs) |
static_cast<underlying
>(rhs));
117 -> std::enable_if_t<adobe::implementation::has_enabled_bitmask<T>, T> {
118 using underlying = std::underlying_type_t<T>;
119 return static_cast<T
>(
static_cast<underlying
>(lhs) ^
static_cast<underlying
>(rhs));
124 -> std::enable_if_t<adobe::implementation::has_enabled_bitmask<T>, T> {
125 return lhs = lhs ^ rhs;
130 -> std::enable_if_t<adobe::implementation::has_enabled_bitmask<T>, T> {
131 return lhs = lhs & rhs;
136 -> std::enable_if_t<adobe::implementation::has_enabled_bitmask<T>, T> {
137 return lhs = lhs | rhs;
141#define ADOBE_DEFINE_ARITHMETIC_OPS(EnumType) \
142 constexpr auto adobe_enable_arithmetic_enum(EnumType)->std::true_type;
145 -> std::enable_if_t<adobe::implementation::has_enabled_arithmetic<T>, T> {
146 using underlying = std::underlying_type_t<T>;
147 return static_cast<T
>(+
static_cast<underlying
>(a));
152 -> std::enable_if_t<adobe::implementation::has_enabled_arithmetic<T>, T> {
153 using underlying = std::underlying_type_t<T>;
154 return static_cast<T
>(-
static_cast<underlying
>(a));
159 -> std::enable_if_t<adobe::implementation::has_enabled_arithmetic<T>, T> {
160 using underlying = std::underlying_type_t<T>;
161 return static_cast<T
>(
static_cast<underlying
>(lhs) +
static_cast<underlying
>(rhs));
166 -> std::enable_if_t<adobe::implementation::has_enabled_arithmetic<T>, T> {
167 using underlying = std::underlying_type_t<T>;
168 return static_cast<T
>(
static_cast<underlying
>(lhs) -
static_cast<underlying
>(rhs));
173 -> std::enable_if_t<adobe::implementation::has_enabled_arithmetic<T>, T> {
174 using underlying = std::underlying_type_t<T>;
175 return static_cast<T
>(
static_cast<underlying
>(lhs) *
static_cast<underlying
>(rhs));
180 -> std::enable_if_t<adobe::implementation::has_enabled_arithmetic<T>, T> {
181 using underlying = std::underlying_type_t<T>;
182 return static_cast<T
>(
static_cast<underlying
>(lhs) /
static_cast<underlying
>(rhs));
187 -> std::enable_if_t<adobe::implementation::has_enabled_arithmetic<T>, T> {
188 using underlying = std::underlying_type_t<T>;
189 return static_cast<T
>(
static_cast<underlying
>(lhs) %
static_cast<underlying
>(rhs));
194 -> std::enable_if_t<adobe::implementation::has_enabled_arithmetic<T>, T> {
195 return lhs = lhs + rhs;
200 -> std::enable_if_t<adobe::implementation::has_enabled_arithmetic<T>, T> {
201 return lhs = lhs - rhs;
206 -> std::enable_if_t<adobe::implementation::has_enabled_arithmetic<T>, T> {
207 return lhs = lhs * rhs;
212 -> std::enable_if_t<adobe::implementation::has_enabled_arithmetic<T>, T> {
213 return lhs = lhs / rhs;
218 -> std::enable_if_t<adobe::implementation::has_enabled_arithmetic<T>, T> {
219 return lhs = lhs % rhs;
224 -> std::enable_if_t<adobe::implementation::has_enabled_arithmetic<T>, T> {
225 return lhs +=
static_cast<T
>(1);
230 -> std::enable_if_t<adobe::implementation::has_enabled_arithmetic<T>, T> {
232 lhs +=
static_cast<T
>(1);
238 -> std::enable_if_t<adobe::implementation::has_enabled_arithmetic<T>, T> {
239 return lhs -=
static_cast<T
>(1);
244 -> std::enable_if_t<adobe::implementation::has_enabled_arithmetic<T>, T> {
246 lhs -=
static_cast<T
>(1);
constexpr auto operator&(const T lhs, const T rhs) -> std::enable_if_t< adobe::implementation::has_enabled_bitmask< T >, T >
constexpr auto operator+(const T a) -> std::enable_if_t< adobe::implementation::has_enabled_arithmetic< T >, T >
constexpr auto operator%=(T &lhs, const T rhs) -> std::enable_if_t< adobe::implementation::has_enabled_arithmetic< T >, T >
constexpr auto operator/(const T lhs, const T rhs) -> std::enable_if_t< adobe::implementation::has_enabled_arithmetic< T >, T >
constexpr auto operator++(T &lhs) -> std::enable_if_t< adobe::implementation::has_enabled_arithmetic< T >, T >
constexpr auto operator&=(T &lhs, const T rhs) -> std::enable_if_t< adobe::implementation::has_enabled_bitmask< T >, T >
constexpr auto operator/=(T &lhs, const T rhs) -> std::enable_if_t< adobe::implementation::has_enabled_arithmetic< T >, T >
constexpr auto operator+=(T &lhs, const T rhs) -> std::enable_if_t< adobe::implementation::has_enabled_arithmetic< T >, T >
constexpr auto operator*=(T &lhs, const T rhs) -> std::enable_if_t< adobe::implementation::has_enabled_arithmetic< T >, T >
constexpr auto operator^=(T &lhs, const T rhs) -> std::enable_if_t< adobe::implementation::has_enabled_bitmask< T >, T >
constexpr auto operator*(const T lhs, const T rhs) -> std::enable_if_t< adobe::implementation::has_enabled_arithmetic< T >, T >
constexpr auto operator--(T &lhs) -> std::enable_if_t< adobe::implementation::has_enabled_arithmetic< T >, T >
constexpr auto operator-(const T a) -> std::enable_if_t< adobe::implementation::has_enabled_arithmetic< T >, T >
constexpr auto operator^(const T lhs, const T rhs) -> std::enable_if_t< adobe::implementation::has_enabled_bitmask< T >, T >
constexpr auto operator%(const T lhs, const T rhs) -> std::enable_if_t< adobe::implementation::has_enabled_arithmetic< T >, T >
constexpr auto operator~(const T a) -> std::enable_if_t< adobe::implementation::has_enabled_bitmask< T >, T >
constexpr auto operator|(const T lhs, const T rhs) -> std::enable_if_t< adobe::implementation::has_enabled_bitmask< T >, T >
constexpr auto operator|=(T &lhs, const T rhs) -> std::enable_if_t< adobe::implementation::has_enabled_bitmask< T >, T >
constexpr auto operator-=(T &lhs, const T rhs) -> std::enable_if_t< adobe::implementation::has_enabled_arithmetic< T >, T >
auto adobe_enable_bitmask_enum(...) -> std::false_type
auto adobe_enable_arithmetic_enum(...) -> std::false_type