diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-10-23 18:55:45 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-10-23 19:02:39 +0100 |
| commit | 3e797a3d152b59302365a7c11c5253292cd34ee7 (patch) | |
| tree | b9f9423e3216e38221272d8d1ca80215782ebde8 /src/normal.cc | |
| parent | 5eb8989192445b0505933fcdb1c4f489d4bdc7f9 (diff) | |
centralize bit operation support for enum used as flags
Diffstat (limited to 'src/normal.cc')
| -rw-r--r-- | src/normal.cc | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/normal.cc b/src/normal.cc index 67640b7d..a7c49b2f 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -8,6 +8,7 @@ #include "context.hh" #include "debug.hh" #include "face_registry.hh" +#include "flags.hh" #include "file.hh" #include "option_manager.hh" #include "register_manager.hh" @@ -956,14 +957,8 @@ enum class SelectFlags Inclusive = 2, Extend = 4 }; -constexpr SelectFlags operator|(SelectFlags lhs, SelectFlags rhs) -{ - return (SelectFlags)((int) lhs | (int) rhs); -} -constexpr bool operator&(SelectFlags lhs, SelectFlags rhs) -{ - return ((int) lhs & (int) rhs) != 0; -} + +template<> struct WithBitOps<SelectFlags> : std::true_type {}; template<SelectFlags flags> void select_to_next_char(Context& context, int param) |
