BWAPI
|
00001 #pragma once 00002 00003 // enums, why you no type safe and pollute my namespaces? 00004 template<typename def, typename inner = typename def::type> 00005 class SafeEnum : public def 00006 { 00007 public: 00008 SafeEnum() : mValue() {} 00009 SafeEnum(inner v) : mValue(v) {} 00010 00011 inner underlying() const { return mValue; } 00012 00013 bool operator == (const SafeEnum &other) const { return mValue == other.mValue; } 00014 bool operator != (const SafeEnum &other) const { return mValue != other.mValue; } 00015 bool operator < (const SafeEnum &other) const { return mValue < other.mValue; } 00016 bool operator <= (const SafeEnum &other) const { return mValue <= other.mValue; } 00017 bool operator > (const SafeEnum &other) const { return mValue > other.mValue; } 00018 bool operator >= (const SafeEnum &other) const { return mValue >= other.mValue; } 00019 00020 private: 00021 inner mValue; 00022 };