forked from boostorg/type_traits
Implement is_scoped_enum and is_unscoped_enum
This commit is contained in:
1 parent
f8e9879d4e
commit
7a071a5918
8 files changed
+219
No files matched your search
@@ -128,9 +128,11 @@
|
||||
#include <boost/type_traits/is_rvalue_reference.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_scalar.hpp>
|
||||
#include <boost/type_traits/is_scoped_enum.hpp>
|
||||
#include <boost/type_traits/is_signed.hpp>
|
||||
#include <boost/type_traits/is_stateless.hpp>
|
||||
#include <boost/type_traits/is_union.hpp>
|
||||
#include <boost/type_traits/is_unscoped_enum.hpp>
|
||||
#include <boost/type_traits/is_unsigned.hpp>
|
||||
#include <boost/type_traits/is_virtual_base_of.hpp>
|
||||
#include <boost/type_traits/is_void.hpp>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
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)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_TT_IS_SCOPED_ENUM_HPP_INCLUDED
|
||||
#define BOOST_TT_IS_SCOPED_ENUM_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/conjunction.hpp>
|
||||
#include <boost/type_traits/is_enum.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/negation.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template<class T>
|
||||
struct is_scoped_enum
|
||||
: conjunction<is_enum<T>, negation<is_convertible<T, int> > >::type { };
|
||||
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
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)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_TT_IS_UNSCOPED_ENUM_HPP_INCLUDED
|
||||
#define BOOST_TT_IS_UNSCOPED_ENUM_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/conjunction.hpp>
|
||||
#include <boost/type_traits/is_enum.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template<class T>
|
||||
struct is_unscoped_enum
|
||||
: conjunction<is_enum<T>, is_convertible<T, int> >::type { };
|
||||
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user