mirror of
https://github.com/boostorg/utility.git
synced 2025-07-31 21:34:46 +02:00
Replace mpl primitives with type_traits
This commit is contained in:
@@ -25,8 +25,8 @@
|
|||||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||||
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||||
struct tr1_result_of<F(BOOST_RESULT_OF_ARGS)>
|
struct tr1_result_of<F(BOOST_RESULT_OF_ARGS)>
|
||||||
: mpl::if_<
|
: conditional<
|
||||||
mpl::or_< is_pointer<F>, is_member_function_pointer<F> >
|
is_pointer<F>::value || is_member_function_pointer<F>::value
|
||||||
, boost::detail::tr1_result_of_impl<
|
, boost::detail::tr1_result_of_impl<
|
||||||
typename remove_cv<F>::type,
|
typename remove_cv<F>::type,
|
||||||
typename remove_cv<F>::type(BOOST_RESULT_OF_ARGS),
|
typename remove_cv<F>::type(BOOST_RESULT_OF_ARGS),
|
||||||
@@ -46,7 +46,7 @@ struct result_of<F(BOOST_RESULT_OF_ARGS)>
|
|||||||
#ifdef BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK
|
#ifdef BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK
|
||||||
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||||
struct result_of<F(BOOST_RESULT_OF_ARGS)>
|
struct result_of<F(BOOST_RESULT_OF_ARGS)>
|
||||||
: mpl::if_<mpl::or_<detail::has_result_type<F>, detail::has_result<F> >,
|
: conditional<detail::has_result_type<F>::value || detail::has_result<F>::value,
|
||||||
tr1_result_of<F(BOOST_RESULT_OF_ARGS)>,
|
tr1_result_of<F(BOOST_RESULT_OF_ARGS)>,
|
||||||
detail::cpp0x_result_of<F(BOOST_RESULT_OF_ARGS)> >::type { };
|
detail::cpp0x_result_of<F(BOOST_RESULT_OF_ARGS)> >::type { };
|
||||||
#endif // BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK
|
#endif // BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK
|
||||||
@@ -57,8 +57,8 @@ namespace detail {
|
|||||||
|
|
||||||
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||||
struct cpp0x_result_of<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))>
|
struct cpp0x_result_of<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))>
|
||||||
: mpl::if_<
|
: conditional<
|
||||||
is_member_function_pointer<F>
|
is_member_function_pointer<F>::value
|
||||||
, detail::tr1_result_of_impl<
|
, detail::tr1_result_of_impl<
|
||||||
typename remove_cv<F>::type,
|
typename remove_cv<F>::type,
|
||||||
typename remove_cv<F>::type(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false
|
typename remove_cv<F>::type(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false
|
||||||
@@ -93,11 +93,11 @@ struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<F *>
|
|||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
struct BOOST_PP_CAT(result_of_select_call_wrapper_type_, BOOST_PP_ITERATION())
|
struct BOOST_PP_CAT(result_of_select_call_wrapper_type_, BOOST_PP_ITERATION())
|
||||||
: mpl::eval_if<
|
: conditional<
|
||||||
is_class<typename remove_reference<F>::type>,
|
is_class<typename remove_reference<F>::type>::value,
|
||||||
result_of_wrap_callable_class<F>,
|
result_of_wrap_callable_class<F>,
|
||||||
mpl::identity<BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<typename remove_cv<typename remove_reference<F>::type>::type> >
|
type_identity<BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<typename remove_cv<typename remove_reference<F>::type>::type> >
|
||||||
>
|
>::type
|
||||||
{};
|
{};
|
||||||
|
|
||||||
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename T)>
|
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename T)>
|
||||||
@@ -108,7 +108,7 @@ struct BOOST_PP_CAT(result_of_is_callable_, BOOST_PP_ITERATION()) {
|
|||||||
(boost::declval<wrapper_t>()(BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT)), result_of_weird_type())
|
(boost::declval<wrapper_t>()(BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT)), result_of_weird_type())
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
typedef mpl::bool_<value> type;
|
typedef integral_constant<bool, value> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||||
|
@@ -19,18 +19,16 @@
|
|||||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
#include <boost/mpl/has_xxx.hpp>
|
#include <boost/mpl/has_xxx.hpp>
|
||||||
#include <boost/mpl/if.hpp>
|
|
||||||
#include <boost/mpl/eval_if.hpp>
|
|
||||||
#include <boost/mpl/bool.hpp>
|
|
||||||
#include <boost/mpl/identity.hpp>
|
|
||||||
#include <boost/mpl/or.hpp>
|
|
||||||
#include <boost/type_traits/is_class.hpp>
|
#include <boost/type_traits/is_class.hpp>
|
||||||
#include <boost/type_traits/is_pointer.hpp>
|
#include <boost/type_traits/is_pointer.hpp>
|
||||||
#include <boost/type_traits/is_member_function_pointer.hpp>
|
#include <boost/type_traits/is_member_function_pointer.hpp>
|
||||||
#include <boost/type_traits/remove_cv.hpp>
|
#include <boost/type_traits/remove_cv.hpp>
|
||||||
#include <boost/type_traits/remove_reference.hpp>
|
#include <boost/type_traits/remove_reference.hpp>
|
||||||
#include <boost/utility/declval.hpp>
|
#include <boost/type_traits/declval.hpp>
|
||||||
#include <boost/utility/enable_if.hpp>
|
#include <boost/type_traits/conditional.hpp>
|
||||||
|
#include <boost/type_traits/type_identity.hpp>
|
||||||
|
#include <boost/type_traits/integral_constant.hpp>
|
||||||
|
#include <boost/core/enable_if.hpp>
|
||||||
|
|
||||||
#ifndef BOOST_RESULT_OF_NUM_ARGS
|
#ifndef BOOST_RESULT_OF_NUM_ARGS
|
||||||
# define BOOST_RESULT_OF_NUM_ARGS 16
|
# define BOOST_RESULT_OF_NUM_ARGS 16
|
||||||
@@ -180,10 +178,10 @@ struct tr1_result_of_impl<F, FArgs, true>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename FArgs>
|
template<typename FArgs>
|
||||||
struct is_function_with_no_args : mpl::false_ {};
|
struct is_function_with_no_args : false_type {};
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
struct is_function_with_no_args<F(void)> : mpl::true_ {};
|
struct is_function_with_no_args<F(void)> : true_type {};
|
||||||
|
|
||||||
template<typename F, typename FArgs>
|
template<typename F, typename FArgs>
|
||||||
struct result_of_nested_result : F::template result<FArgs>
|
struct result_of_nested_result : F::template result<FArgs>
|
||||||
@@ -191,7 +189,7 @@ struct result_of_nested_result : F::template result<FArgs>
|
|||||||
|
|
||||||
template<typename F, typename FArgs>
|
template<typename F, typename FArgs>
|
||||||
struct tr1_result_of_impl<F, FArgs, false>
|
struct tr1_result_of_impl<F, FArgs, false>
|
||||||
: mpl::if_<is_function_with_no_args<FArgs>,
|
: conditional<is_function_with_no_args<FArgs>::value,
|
||||||
result_of_void_impl<F>,
|
result_of_void_impl<F>,
|
||||||
result_of_nested_result<F, FArgs> >::type
|
result_of_nested_result<F, FArgs> >::type
|
||||||
{};
|
{};
|
||||||
|
Reference in New Issue
Block a user