From 4ccc8bd3c1235fd2fd8d700d0ae942d705fba8ca Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 31 Jul 2016 10:27:28 -1000 Subject: [PATCH] Use constexpr for evaluating bitwise enums --- include/kabufuda/Util.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/kabufuda/Util.hpp b/include/kabufuda/Util.hpp index 298ff4a..dfa918a 100644 --- a/include/kabufuda/Util.hpp +++ b/include/kabufuda/Util.hpp @@ -36,29 +36,29 @@ #ifndef ENABLE_BITWISE_ENUM #define ENABLE_BITWISE_ENUM(type)\ -inline type operator|(type a, type b)\ +constexpr type operator|(type a, type b)\ {\ using T = std::underlying_type_t;\ return type(static_cast(a) | static_cast(b));\ }\ -inline type operator&(type a, type b)\ +constexpr type operator&(type a, type b)\ {\ using T = std::underlying_type_t;\ return type(static_cast(a) & static_cast(b));\ }\ -inline type& operator|=(type& a, const type& b)\ +constexpr type& operator|=(type& a, const type& b)\ {\ using T = std::underlying_type_t;\ a = type(static_cast(a) | static_cast(b));\ return a;\ }\ -inline type& operator&=(type& a, const type& b)\ +constexpr type& operator&=(type& a, const type& b)\ {\ using T = std::underlying_type_t;\ a = type(static_cast(a) & static_cast(b));\ return a;\ }\ -inline type operator~(const type& key)\ +constexpr type operator~(const type& key)\ {\ using T = std::underlying_type_t;\ return type(~static_cast(key));\