|
|
|
|
@@ -43,7 +43,8 @@ namespace boost
|
|
|
|
|
* @throws No-throws.
|
|
|
|
|
*/
|
|
|
|
|
template <typename UnderlyingType, typename EnumType>
|
|
|
|
|
UnderlyingType underlying_cast(EnumType v)
|
|
|
|
|
inline
|
|
|
|
|
BOOST_CONSTEXPR UnderlyingType underlying_cast(EnumType v) BOOST_NOEXCEPT
|
|
|
|
|
{
|
|
|
|
|
return v.get_underlying_value_();
|
|
|
|
|
}
|
|
|
|
|
@@ -61,7 +62,7 @@ namespace boost
|
|
|
|
|
*/
|
|
|
|
|
template <typename EnumType>
|
|
|
|
|
inline
|
|
|
|
|
typename EnumType::enum_type native_value(EnumType e)
|
|
|
|
|
BOOST_CONSTEXPR typename EnumType::enum_type native_value(EnumType e) BOOST_NOEXCEPT
|
|
|
|
|
{
|
|
|
|
|
return e.get_native_value_();
|
|
|
|
|
}
|
|
|
|
|
@@ -75,14 +76,15 @@ namespace boost
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename UnderlyingType, typename EnumType>
|
|
|
|
|
UnderlyingType underlying_cast(EnumType v)
|
|
|
|
|
inline
|
|
|
|
|
BOOST_CONSTEXPR UnderlyingType underlying_cast(EnumType v) BOOST_NOEXCEPT
|
|
|
|
|
{
|
|
|
|
|
return static_cast<UnderlyingType>(v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename EnumType>
|
|
|
|
|
inline
|
|
|
|
|
EnumType native_value(EnumType e)
|
|
|
|
|
BOOST_CONSTEXPR EnumType native_value(EnumType e) BOOST_NOEXCEPT
|
|
|
|
|
{
|
|
|
|
|
return e;
|
|
|
|
|
}
|
|
|
|
|
@@ -96,7 +98,7 @@ namespace boost
|
|
|
|
|
#ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
|
|
|
|
|
|
|
|
|
#define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR \
|
|
|
|
|
explicit operator underlying_type() const BOOST_NOEXCEPT { return get_underlying_value_(); }
|
|
|
|
|
explicit BOOST_CONSTEXPR operator underlying_type() const BOOST_NOEXCEPT { return get_underlying_value_(); }
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
@@ -115,8 +117,8 @@ namespace boost
|
|
|
|
|
typedef void is_boost_scoped_enum_tag; \
|
|
|
|
|
typedef UnderlyingType underlying_type; \
|
|
|
|
|
EnumType() BOOST_NOEXCEPT {} \
|
|
|
|
|
explicit EnumType(underlying_type v) BOOST_NOEXCEPT : v_(v) {} \
|
|
|
|
|
underlying_type get_underlying_value_() const BOOST_NOEXCEPT { return v_; } \
|
|
|
|
|
explicit BOOST_CONSTEXPR EnumType(underlying_type v) BOOST_NOEXCEPT : v_(v) {} \
|
|
|
|
|
BOOST_CONSTEXPR underlying_type get_underlying_value_() const BOOST_NOEXCEPT { return v_; } \
|
|
|
|
|
BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR \
|
|
|
|
|
private: \
|
|
|
|
|
underlying_type v_; \
|
|
|
|
|
@@ -125,30 +127,30 @@ namespace boost
|
|
|
|
|
enum enum_type
|
|
|
|
|
|
|
|
|
|
#define BOOST_SCOPED_ENUM_DECLARE_END2() \
|
|
|
|
|
enum_type get_native_value_() const BOOST_NOEXCEPT { return enum_type(v_); } \
|
|
|
|
|
friend bool operator ==(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==enum_type(rhs.v_); } \
|
|
|
|
|
friend bool operator ==(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==rhs; } \
|
|
|
|
|
friend bool operator ==(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs==enum_type(rhs.v_); } \
|
|
|
|
|
friend bool operator !=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=enum_type(rhs.v_); } \
|
|
|
|
|
friend bool operator !=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=rhs; } \
|
|
|
|
|
friend bool operator !=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs!=enum_type(rhs.v_); } \
|
|
|
|
|
friend bool operator <(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<enum_type(rhs.v_); } \
|
|
|
|
|
friend bool operator <(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<rhs; } \
|
|
|
|
|
friend bool operator <(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs<enum_type(rhs.v_); } \
|
|
|
|
|
friend bool operator <=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<=enum_type(rhs.v_); } \
|
|
|
|
|
friend bool operator <=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<=rhs; } \
|
|
|
|
|
friend bool operator <=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs<=enum_type(rhs.v_); } \
|
|
|
|
|
friend bool operator >(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>enum_type(rhs.v_); } \
|
|
|
|
|
friend bool operator >(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>rhs; } \
|
|
|
|
|
friend bool operator >(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>enum_type(rhs.v_); } \
|
|
|
|
|
friend bool operator >=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=enum_type(rhs.v_); } \
|
|
|
|
|
friend bool operator >=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=rhs; } \
|
|
|
|
|
friend bool operator >=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>=enum_type(rhs.v_); } \
|
|
|
|
|
BOOST_CONSTEXPR enum_type get_native_value_() const BOOST_NOEXCEPT { return enum_type(v_); } \
|
|
|
|
|
friend BOOST_CONSTEXPR bool operator ==(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==enum_type(rhs.v_); } \
|
|
|
|
|
friend BOOST_CONSTEXPR bool operator ==(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==rhs; } \
|
|
|
|
|
friend BOOST_CONSTEXPR bool operator ==(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs==enum_type(rhs.v_); } \
|
|
|
|
|
friend BOOST_CONSTEXPR bool operator !=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=enum_type(rhs.v_); } \
|
|
|
|
|
friend BOOST_CONSTEXPR bool operator !=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=rhs; } \
|
|
|
|
|
friend BOOST_CONSTEXPR bool operator !=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs!=enum_type(rhs.v_); } \
|
|
|
|
|
friend BOOST_CONSTEXPR bool operator <(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<enum_type(rhs.v_); } \
|
|
|
|
|
friend BOOST_CONSTEXPR bool operator <(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<rhs; } \
|
|
|
|
|
friend BOOST_CONSTEXPR bool operator <(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs<enum_type(rhs.v_); } \
|
|
|
|
|
friend BOOST_CONSTEXPR bool operator <=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<=enum_type(rhs.v_); } \
|
|
|
|
|
friend BOOST_CONSTEXPR bool operator <=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<=rhs; } \
|
|
|
|
|
friend BOOST_CONSTEXPR bool operator <=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs<=enum_type(rhs.v_); } \
|
|
|
|
|
friend BOOST_CONSTEXPR bool operator >(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>enum_type(rhs.v_); } \
|
|
|
|
|
friend BOOST_CONSTEXPR bool operator >(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>rhs; } \
|
|
|
|
|
friend BOOST_CONSTEXPR bool operator >(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>enum_type(rhs.v_); } \
|
|
|
|
|
friend BOOST_CONSTEXPR bool operator >=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=enum_type(rhs.v_); } \
|
|
|
|
|
friend BOOST_CONSTEXPR bool operator >=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=rhs; } \
|
|
|
|
|
friend BOOST_CONSTEXPR bool operator >=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>=enum_type(rhs.v_); } \
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define BOOST_SCOPED_ENUM_DECLARE_END(EnumType) \
|
|
|
|
|
; \
|
|
|
|
|
EnumType(enum_type v) BOOST_NOEXCEPT : v_(v) {} \
|
|
|
|
|
BOOST_CONSTEXPR EnumType(enum_type v) BOOST_NOEXCEPT : v_(v) {} \
|
|
|
|
|
BOOST_SCOPED_ENUM_DECLARE_END2()
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|