#pragma once #include // uint8_t #include "Bits.h" template class Flag { public: static_assert(std::is_arithmetic<_Ty>::value, "_Ty must be an arithmetic type"); typedef _Ty value_type; _Ty value; inline Flag() : value() { } inline Flag(_Ty value) : value(value) { } inline void Set(_Ty value) { bits::Set(this->value, value); } inline void Unset(_Ty value) { bits::Unset(this->value, value); } inline bool Has(_Ty value) const { return bits::Has(this->value, value); } }; template struct IsFlag : public std::false_type { }; template struct IsFlag> : public std::true_type { }; typedef Flag FlagUint8; typedef Flag FlagUint16; typedef Flag FlagUint32; typedef Flag FlagUint64; typedef Flag FlagInt8; typedef Flag FlagInt16; typedef Flag FlagInt32; typedef Flag FlagInt64;