...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
template<class T>
struct is_scoped_enum
: true_type-or-false_type
{ };
Inherits: If T is a (possibly cv-qualified)
scoped enumeration type (enum class
but not enum
),
then inherits from true_type,
otherwise inherits from false_type.
Header: #include
<boost/type_traits/is_scoped_enum.hpp>
Compiler Compatibility: All current compilers are supported by this trait.
Examples:
Given:
enum class color { red, blue };
andenum fruit { apple, orange };
is_scoped_enum<color>
inherits fromtrue_type
.
is_scoped_enum<fruit>
inherits fromfalse_type
.
is_scoped_enum<color const>::type
is the typetrue_type
.
is_scoped_enum<color>::value
is an integral constant expression that evaluates to true.
is_scoped_enum<color&>::value
is an integral constant expression that evaluates to false.
is_scoped_enum<color*>::value
is an integral constant expression that evaluates to false.
is_scoped_enum<T>::value_type
is the typebool
.