Skip to content

Commit

Permalink
Add comment how to use EnumFlag
Browse files Browse the repository at this point in the history
  • Loading branch information
0blu committed Sep 7, 2024
1 parent eb2d287 commit 60ddc5c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/shared/EnumFlag.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,25 @@

#include <type_traits>

/* Example usage:
// In header
enum class MyCoolFlags
{
None = 0,
FlagA = (1 << 0),
FlagB = (1 << 0),
FlagC = (1 << 0),
FlagD = (1 << 0),
FlagE = (1 << 0),
};
DEFINE_ENUM_FLAG(MyCoolFlags);
// In CPP file
void MyCoolFunction(EnumFlag<MyCoolFlags> flags)
{
if (flags.HasFlag(MyCoolFlags::FlagA))
// Do something
}
*/
template<typename T>
constexpr bool IsEnumFlag(T) { return false; }

Expand Down

0 comments on commit 60ddc5c

Please sign in to comment.