![]() |
Home | Libraries | People | FAQ | More |
Some of the enumerations defined in the standard library are scoped enums.
On compilers that don't support them, the library uses a class to wrap the underlying type. Instead of
enum class future_errc { broken_promise, future_already_retrieved, promise_already_satisfied, no_state };
the library declare these types as
BOOST_SCOPED_ENUM_DECLARE_BEGIN(future_errc) { broken_promise, future_already_retrieved, promise_already_satisfied, no_state } BOOST_SCOPED_ENUM_DECLARE_END(future_errc)
These macros allows to use 'future_errc' in almost all the cases as a scoped enum.
There are however some limitations:
Instead of
switch (ev) { case future_errc::broken_promise: // ...
use
switch (boost::native_value(ev)) { case future_errc::broken_promise:
And instead of
#ifdef BOOST_NO_CXX11_SCOPED_ENUMS template <> struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc> : public true_type { }; #endif
use
#ifdef BOOST_NO_CXX11_SCOPED_ENUMS template <> struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc::enum_type> : public true_type { }; #endif