Changeset 11096 for code/trunk/src/libraries/util/OrxEnum.h
- Timestamp:
- Jan 25, 2016, 9:33:11 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/util/OrxEnum.h
r7401 r11096 61 61 { 62 62 public: 63 OrxEnum() { } 64 OrxEnum(int type) { type_ = type; } 65 OrxEnum(const T& instance) { type_ = instance.type_; } 63 constexpr OrxEnum() : type_() {} 64 constexpr OrxEnum(int type) : type_(type) {} 65 constexpr OrxEnum(const T& instance) : type_(instance.type_) {} 66 constexpr OrxEnum(const OrxEnum& instance) = delete; 66 67 67 operator int(){ return type_; }68 T& operator =(int type) { type_ = type; return *this; }69 bool operator <(const T& right) const { return (type_ < right.type_); }70 bool operator >(const T& right) const { return (type_ > right.type_); }68 constexpr operator int() const { return type_; } 69 T& operator =(int type) { type_ = type; return *this; } 70 constexpr bool operator <(const T& right) const { return (type_ < right.type_); } 71 constexpr bool operator >(const T& right) const { return (type_ > right.type_); } 71 72 72 73 private: 73 OrxEnum(const OrxEnum& instance);74 74 int type_; 75 75 }; … … 77 77 78 78 /// See orxonox::OrxEnum for more info 79 #define OrxEnumConstructors(enumName) \80 enumName() { } \81 enumName(int type) : OrxEnum<enumName>(type) { } \82 enumName(const enumName& inst) : OrxEnum<enumName>(inst) { } \79 #define OrxEnumConstructors(enumName) \ 80 constexpr enumName() { } \ 81 constexpr enumName(int type) : OrxEnum<enumName>(type) { } \ 82 constexpr enumName(const enumName& inst) : OrxEnum<enumName>(inst) { } \ 83 83 void dummyFunction() 84 84
Note: See TracChangeset
for help on using the changeset viewer.