forked from boostorg/type_traits
Implement conjunction, disjunction, negation
This commit is contained in:
1 parent
bd5bede326
commit
f8e9879d4e
11 files changed
+315
No files matched your search
@@ -21,11 +21,13 @@
|
||||
#include <boost/type_traits/alignment_of.hpp>
|
||||
#include <boost/type_traits/common_type.hpp>
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
#include <boost/type_traits/conjunction.hpp>
|
||||
#include <boost/type_traits/copy_cv.hpp>
|
||||
#include <boost/type_traits/copy_cv_ref.hpp>
|
||||
#include <boost/type_traits/copy_reference.hpp>
|
||||
#include <boost/type_traits/decay.hpp>
|
||||
#include <boost/type_traits/declval.hpp>
|
||||
#include <boost/type_traits/disjunction.hpp>
|
||||
#include <boost/type_traits/enable_if.hpp>
|
||||
#include <boost/type_traits/extent.hpp>
|
||||
#include <boost/type_traits/floating_point_promotion.hpp>
|
||||
@@ -136,6 +138,7 @@
|
||||
#include <boost/type_traits/make_signed.hpp>
|
||||
#include <boost/type_traits/make_unsigned.hpp>
|
||||
#include <boost/type_traits/make_void.hpp>
|
||||
#include <boost/type_traits/negation.hpp>
|
||||
#include <boost/type_traits/rank.hpp>
|
||||
#include <boost/type_traits/remove_all_extents.hpp>
|
||||
#include <boost/type_traits/remove_bounds.hpp>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
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_CONJUNCTION_HPP_INCLUDED
|
||||
#define BOOST_TT_CONJUNCTION_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template<class...>
|
||||
struct conjunction
|
||||
: true_type { };
|
||||
|
||||
template<class T>
|
||||
struct conjunction<T>
|
||||
: T { };
|
||||
|
||||
template<class T, class... U>
|
||||
struct conjunction<T, U...>
|
||||
: conditional<bool(T::value), conjunction<U...>, T>::type { };
|
||||
#else
|
||||
template<class T, class U>
|
||||
struct conjunction
|
||||
: conditional<bool(T::value), U, T>::type { };
|
||||
#endif
|
||||
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
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_DISJUNCTION_HPP_INCLUDED
|
||||
#define BOOST_TT_DISJUNCTION_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template<class...>
|
||||
struct disjunction
|
||||
: false_type { };
|
||||
|
||||
template<class T>
|
||||
struct disjunction<T>
|
||||
: T { };
|
||||
|
||||
template<class T, class... U>
|
||||
struct disjunction<T, U...>
|
||||
: conditional<bool(T::value), T, disjunction<U...> >::type { };
|
||||
#else
|
||||
template<class T, class U>
|
||||
struct disjunction
|
||||
: conditional<bool(T::value), T, U>::type { };
|
||||
#endif
|
||||
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
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_NEGATION_HPP_INCLUDED
|
||||
#define BOOST_TT_NEGATION_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template<class T>
|
||||
struct negation
|
||||
: integral_constant<bool, !bool(T::value)> { };
|
||||
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user