summaryrefslogtreecommitdiffhomepage
path: root/compat/enum-operators.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-06-20 18:44:26 +0200
committerStanislaw Halik <sthalik@misaki.pl>2019-06-20 18:44:26 +0200
commit74ce228b1e3e756174c2e75579bfe500701ee570 (patch)
treefbfa051d259d51fed94c91c11d793786699ca6da /compat/enum-operators.hpp
parent9b2df9f1c597ed531f5b675ae32eec6fe515e4a6 (diff)
compat: sprinkle constexpr
Diffstat (limited to 'compat/enum-operators.hpp')
-rw-r--r--compat/enum-operators.hpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/compat/enum-operators.hpp b/compat/enum-operators.hpp
index 188a081d..e4f81a39 100644
--- a/compat/enum-operators.hpp
+++ b/compat/enum-operators.hpp
@@ -3,7 +3,7 @@
#include <type_traits>
#define OTR_FLAGS_OP2(type, op) \
- inline type operator op (type a, type b) \
+ constexpr inline type operator op (type a, type b) \
{ \
using t_ = std::underlying_type_t<type>; \
return type(t_((a)) op t_((b))); \
@@ -14,14 +14,14 @@
type operator op (type, u) = delete // end
#define OTR_FLAGS_OP1(type, op) \
- inline type operator op (type x) \
+ constexpr inline type operator op (type x) \
{ \
using t_ = std::underlying_type_t<type>; \
return type(op t_((x))); \
} // end
#define OTR_FLAGS_ASSIGN_OP(type, op) \
- inline type& operator op ## = (type& lhs, type rhs) \
+ constexpr inline type& operator op ## = (type& lhs, type rhs) \
{ \
using t_ = std::underlying_type_t<decltype(rhs)>; \
lhs = type(t_((lhs)) op t_((rhs))); \