Add helper methods to FlagsEnum where I can make sure that it actually works forsenT

This commit is contained in:
Rasmus Karlsson 2018-03-31 11:23:07 +02:00
parent 700b15c483
commit 2d15716b5f

View file

@ -12,7 +12,7 @@ class FlagsEnum
{
public:
FlagsEnum()
: value((T)0)
: value(static_cast<T>(0))
{
}
@ -50,7 +50,18 @@ public:
return (T &)((Q &)this->value ^= (Q)a);
}
void EnableFlag(T flag)
{
reinterpret_cast<Q &>(this->value) |= static_cast<Q>(flag);
}
bool HasFlag(Q flag) const
{
return (this->value & flag) == flag;
}
T value;
};
} // namespace util
} // namespace chatterino