Skip to content

Commit

Permalink
Add helper macro that defines enum flag operators.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Kovalenko committed Nov 1, 2014
1 parent e37f743 commit 4eecd1d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/common/Util.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#define IMPLEMENT_ENUM_FLAG_OPERATORS(TEnum, TBaseType) \
inline TEnum operator|(TEnum a, TEnum b) { return (TEnum)((TBaseType)a | (TBaseType)b); } \
inline TEnum operator&(TEnum a, TEnum b) { return (TEnum)((TBaseType)a & (TBaseType)b); } \
inline TEnum& operator|=(TEnum& a, TEnum b) { return a = a | b; } \
inline TEnum& operator&=(TEnum& a, TEnum b) { return a = a & b; }

0 comments on commit 4eecd1d

Please sign in to comment.