Implement is_scoped_enum and is_unscoped_enum

This commit is contained in:
Glen Fernandes committed 2020-05-31 02:49:03 -04:00
1 parent f8e9879d4e
commit 7a071a5918
8 files changed
+219

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
[/
Copyright 2020 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt
or copy at http://www.boost.org/LICENSE_1_0.txt).
]
[section:is_scoped_enum is_scoped_enum]
template<class T>
struct is_scoped_enum
: __tof { };
__inherit 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>`
[all_compilers]
__examples
[:Given: `enum class color { red, blue };` and `enum fruit { apple, orange };`]
[:`is_scoped_enum<color>` inherits from `__true_type`.]
[:`is_scoped_enum<fruit>` inherits from `__false_type`.]
[:`is_scoped_enum<color const>::type` is the type `__true_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 type `bool`.]
[endsect]
+45
View File
@@ -0,0 +1,45 @@
[/
Copyright 2020 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt
or copy at http://www.boost.org/LICENSE_1_0.txt).
]
[section:is_unscoped_enum is_unscoped_enum]
template<class T>
struct is_unscoped_enum
: __tof { };
__inherit If T is a (possibly cv-qualified) unscoped enumeration type
(`enum` but not `enum class`), then inherits from __true_type, otherwise
inherits from __false_type.
__header `#include <boost/type_traits/is_unscoped_enum.hpp>`
[all_compilers]
__examples
[:Given: `enum color { red, blue };` and `enum class fruit { apple, orange };`]
[:`is_unscoped_enum<color>` inherits from `__true_type`.]
[:`is_unscoped_enum<fruit>` inherits from `__false_type`.]
[:`is_unscoped_enum<color const>::type` is the type `__true_type`.]
[:`is_unscoped_enum<color>::value` is an integral constant expression that
evaluates to /true/.]
[:`is_unscoped_enum<color&>::value` is an integral constant expression that
evaluates to /false/.]
[:`is_unscoped_enum<color*>::value` is an integral constant expression that
evaluates to /false/.]
[:`is_unscoped_enum<T>::value_type` is the type `bool`.]
[endsect]
+4
View File
@@ -55,6 +55,8 @@
[def __is_unbounded_array [link boost_typetraits.reference.is_unbounded_array is_unbounded_array]]
[def __is_union [link boost_typetraits.reference.is_union is_union]]
[def __is_class [link boost_typetraits.reference.is_class is_class]]
[def __is_scoped_enum [link boost_typetraits.reference.is_scoped_enum is_scoped_enum]]
[def __is_unscoped_enum [link boost_typetraits.reference.is_unscoped_enum is_unscoped_enum]]
[def __is_enum [link boost_typetraits.reference.is_enum is_enum]]
[def __is_enum [link boost_typetraits.reference.is_enum is_enum]]
[def __is_function [link boost_typetraits.reference.is_function is_function]]
@@ -434,10 +436,12 @@ See __has_trivial_constructor.
[include is_rvalue_reference.qbk]
[include is_same.qbk]
[include is_scalar.qbk]
[include is_scoped_enum.qbk]
[include is_signed.qbk]
[include is_stateless.qbk]
[include is_unbounded_array.qbk]
[include is_union.qbk]
[include is_unscoped_enum.qbk]
[include is_unsigned.qbk]
[include is_virtual_base_of.qbk]
[include is_void.qbk]