Commit 2b054f63 by Daniel Frey Committed by Paolo Carlini

functional: Use enable_if instead of __enable_if throughout, do not include ext/type_traits.h.

2010-01-26  Daniel Frey  <d.frey@gmx.de>

	* include/std/functional: Use enable_if instead of __enable_if
	throughout, do not include ext/type_traits.h.
	(is_placeholder, is_bind_expression): Use integral_constant.

From-SVN: r156246
parent e0f66eea
2010-01-26 Daniel Frey <d.frey@gmx.de>
* include/std/functional: Use enable_if instead of __enable_if
throughout, do not include ext/type_traits.h.
(is_placeholder, is_bind_expression): Use integral_constant.
2010-01-25 Paolo Carlini <paolo.carlini@oracle.com> 2010-01-25 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/util/testsuite_common_types.h (has_bitwise_operators): * testsuite/util/testsuite_common_types.h (has_bitwise_operators):
......
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
#include <tuple> #include <tuple>
#include <type_traits> #include <type_traits>
#include <bits/functional_hash.h> #include <bits/functional_hash.h>
#include <ext/type_traits.h>
namespace std namespace std
{ {
...@@ -234,12 +233,12 @@ namespace std ...@@ -234,12 +233,12 @@ namespace std
*/ */
template<typename _Functor, typename... _Args> template<typename _Functor, typename... _Args>
inline inline
typename __gnu_cxx::__enable_if< typename enable_if<
(!is_member_pointer<_Functor>::value (!is_member_pointer<_Functor>::value
&& !is_function<_Functor>::value && !is_function<_Functor>::value
&& !is_function<typename remove_pointer<_Functor>::type>::value), && !is_function<typename remove_pointer<_Functor>::type>::value),
typename result_of<_Functor(_Args...)>::type typename result_of<_Functor(_Args...)>::type
>::__type >::type
__invoke(_Functor& __f, _Args&&... __args) __invoke(_Functor& __f, _Args&&... __args)
{ {
return __f(std::forward<_Args>(__args)...); return __f(std::forward<_Args>(__args)...);
...@@ -248,11 +247,11 @@ namespace std ...@@ -248,11 +247,11 @@ namespace std
// To pick up function references (that will become function pointers) // To pick up function references (that will become function pointers)
template<typename _Functor, typename... _Args> template<typename _Functor, typename... _Args>
inline inline
typename __gnu_cxx::__enable_if< typename enable_if<
(is_pointer<_Functor>::value (is_pointer<_Functor>::value
&& is_function<typename remove_pointer<_Functor>::type>::value), && is_function<typename remove_pointer<_Functor>::type>::value),
typename result_of<_Functor(_Args...)>::type typename result_of<_Functor(_Args...)>::type
>::__type >::type
__invoke(_Functor __f, _Args&&... __args) __invoke(_Functor __f, _Args&&... __args)
{ {
return __f(std::forward<_Args>(__args)...); return __f(std::forward<_Args>(__args)...);
...@@ -769,10 +768,7 @@ namespace std ...@@ -769,10 +768,7 @@ namespace std
*/ */
template<typename _Tp> template<typename _Tp>
struct is_bind_expression struct is_bind_expression
{ static const bool value = false; }; : public false_type { };
template<typename _Tp>
const bool is_bind_expression<_Tp>::value;
/** /**
* @brief Determines if the given type _Tp is a placeholder in a * @brief Determines if the given type _Tp is a placeholder in a
...@@ -780,10 +776,8 @@ namespace std ...@@ -780,10 +776,8 @@ namespace std
*/ */
template<typename _Tp> template<typename _Tp>
struct is_placeholder struct is_placeholder
{ static const int value = 0; }; : public integral_constant<int, 0>
{ };
template<typename _Tp>
const int is_placeholder<_Tp>::value;
/// The type of placeholder objects defined by libstdc++. /// The type of placeholder objects defined by libstdc++.
template<int _Num> struct _Placeholder { }; template<int _Num> struct _Placeholder { };
...@@ -837,10 +831,8 @@ namespace std ...@@ -837,10 +831,8 @@ namespace std
*/ */
template<int _Num> template<int _Num>
struct is_placeholder<_Placeholder<_Num> > struct is_placeholder<_Placeholder<_Num> >
{ static const int value = _Num; }; : public integral_constant<int, _Num>
{ };
template<int _Num>
const int is_placeholder<_Placeholder<_Num> >::value;
/** /**
* Stores a tuple of indices. Used by bind() to extract the elements * Stores a tuple of indices. Used by bind() to extract the elements
...@@ -1346,18 +1338,12 @@ namespace std ...@@ -1346,18 +1338,12 @@ namespace std
/// Class template _Bind is always a bind expression. /// Class template _Bind is always a bind expression.
template<typename _Signature> template<typename _Signature>
struct is_bind_expression<_Bind<_Signature> > struct is_bind_expression<_Bind<_Signature> >
{ static const bool value = true; }; : public true_type { };
template<typename _Signature>
const bool is_bind_expression<_Bind<_Signature> >::value;
/// Class template _Bind_result is always a bind expression. /// Class template _Bind_result is always a bind expression.
template<typename _Result, typename _Signature> template<typename _Result, typename _Signature>
struct is_bind_expression<_Bind_result<_Result, _Signature> > struct is_bind_expression<_Bind_result<_Result, _Signature> >
{ static const bool value = true; }; : public true_type { };
template<typename _Result, typename _Signature>
const bool is_bind_expression<_Bind_result<_Result, _Signature> >::value;
/// bind /// bind
template<typename _Functor, typename... _ArgTypes> template<typename _Functor, typename... _ArgTypes>
...@@ -1850,8 +1836,8 @@ namespace std ...@@ -1850,8 +1836,8 @@ namespace std
*/ */
template<typename _Functor> template<typename _Functor>
function(_Functor __f, function(_Functor __f,
typename __gnu_cxx::__enable_if< typename enable_if<
!is_integral<_Functor>::value, _Useless>::__type !is_integral<_Functor>::value, _Useless>::type
= _Useless()); = _Useless());
/** /**
...@@ -1927,8 +1913,7 @@ namespace std ...@@ -1927,8 +1913,7 @@ namespace std
* reference_wrapper<F>, this function will not throw. * reference_wrapper<F>, this function will not throw.
*/ */
template<typename _Functor> template<typename _Functor>
typename __gnu_cxx::__enable_if<!is_integral<_Functor>::value, typename enable_if<!is_integral<_Functor>::value, function&>::type
function&>::__type
operator=(_Functor&& __f) operator=(_Functor&& __f)
{ {
function(std::forward<_Functor>(__f)).swap(*this); function(std::forward<_Functor>(__f)).swap(*this);
...@@ -1937,8 +1922,7 @@ namespace std ...@@ -1937,8 +1922,7 @@ namespace std
/// @overload /// @overload
template<typename _Functor> template<typename _Functor>
typename __gnu_cxx::__enable_if<!is_integral<_Functor>::value, typename enable_if<!is_integral<_Functor>::value, function&>::type
function&>::__type
operator=(reference_wrapper<_Functor> __f) operator=(reference_wrapper<_Functor> __f)
{ {
function(__f).swap(*this); function(__f).swap(*this);
...@@ -2059,8 +2043,8 @@ namespace std ...@@ -2059,8 +2043,8 @@ namespace std
template<typename _Functor> template<typename _Functor>
function<_Res(_ArgTypes...)>:: function<_Res(_ArgTypes...)>::
function(_Functor __f, function(_Functor __f,
typename __gnu_cxx::__enable_if< typename enable_if<
!is_integral<_Functor>::value, _Useless>::__type) !is_integral<_Functor>::value, _Useless>::type)
: _Function_base() : _Function_base()
{ {
typedef _Function_handler<_Signature_type, _Functor> _My_handler; typedef _Function_handler<_Signature_type, _Functor> _My_handler;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment