| 22 | #ifdef BOOST_NO_SCOPED_ENUMS |
| 23 | #define BOOST_DECLARE_STRONG_ENUM_BEGIN(x) \ |
| 24 | struct x { \ |
| 25 | enum enum_type |
| 26 | |
| 27 | #define BOOST_DECLARE_STRONG_ENUM_END(x) \ |
| 28 | enum_type v_; \ |
| 29 | inline x() {} \ |
| 30 | inline x(enum_type v) : v_(v) {} \ |
| 31 | inline operator int() const {return v_;} \ |
| 32 | friend inline bool operator ==(x lhs, int rhs) {return lhs.v_==rhs;} \ |
| 33 | friend inline bool operator ==(int lhs, x rhs) {return lhs==rhs.v_;} \ |
| 34 | friend inline bool operator !=(x lhs, int rhs) {return lhs.v_!=rhs;} \ |
| 35 | friend inline bool operator !=(int lhs, x rhs) {return lhs!=rhs.v_;} \ |
| 36 | }; |
| 37 | |
| 38 | #define BOOST_STRONG_ENUM_NATIVE(x) x::type |
| 39 | #else // BOOST_NO_SCOPED_ENUMS |
| 40 | #define BOOST_DECLARE_STRONG_ENUM_BEGIN(x) enum class BOOST_SYMBOL_VISIBLE x |
| 41 | #define BOOST_DECLARE_STRONG_ENUM_END(x) |
| 42 | #define BOOST_STRONG_ENUM_NATIVE(x) x |
| 43 | #endif // BOOST_NO_SCOPED_ENUMS |
| 44 | |