From 40962ac03a869cf7e07e0672c0a649371896277b Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 10 Oct 2016 17:15:52 +0100 Subject: Minor simplification to std::_Bind_result helpers * include/std/functional (_Bind_result::__enable_if_void): Use alias template instead of class template. (_Bind_result::__disable_if_void): Likewise. (_Bind_result::__call): Adjust uses of __enable_if_void and __disable_if_void. From-SVN: r240940 --- libstdc++-v3/ChangeLog | 6 +++++ libstdc++-v3/include/std/functional | 48 +++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 34b7d05..afa10f4 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,11 @@ 2016-10-10 Jonathan Wakely + * include/std/functional (_Bind_result::__enable_if_void): Use alias + template instead of class template. + (_Bind_result::__disable_if_void): Likewise. + (_Bind_result::__call): Adjust uses of __enable_if_void and + __disable_if_void. + * doc/xml/manual/intro.xml: Document DR 2296 status. * doc/xml/manual/status_cxx2017.xml: Update status. * include/bits/move.h (__addressof): Add _GLIBCXX_CONSTEXPR and diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional index 1c7523e..2587392 100644 --- a/libstdc++-v3/include/std/functional +++ b/libstdc++-v3/include/std/functional @@ -1000,15 +1000,17 @@ _GLIBCXX_MEM_FN_TRAITS(&&, false_type, true_type) // sfinae types template - struct __enable_if_void : enable_if::value, int> { }; + using __enable_if_void + = typename enable_if{}>::type; + template - struct __disable_if_void : enable_if::value, int> { }; + using __disable_if_void + = typename enable_if{}, _Result>::type; // Call unqualified template - _Result - __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, - typename __disable_if_void<_Res>::type = 0) + __disable_if_void<_Res> + __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) { return _M_f(_Mu<_Bound_args>() (std::get<_Indexes>(_M_bound_args), __args)...); @@ -1016,9 +1018,8 @@ _GLIBCXX_MEM_FN_TRAITS(&&, false_type, true_type) // Call unqualified, return void template - void - __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, - typename __enable_if_void<_Res>::type = 0) + __enable_if_void<_Res> + __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) { _M_f(_Mu<_Bound_args>() (std::get<_Indexes>(_M_bound_args), __args)...); @@ -1026,9 +1027,8 @@ _GLIBCXX_MEM_FN_TRAITS(&&, false_type, true_type) // Call as const template - _Result - __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, - typename __disable_if_void<_Res>::type = 0) const + __disable_if_void<_Res> + __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) const { return _M_f(_Mu<_Bound_args>() (std::get<_Indexes>(_M_bound_args), __args)...); @@ -1036,9 +1036,8 @@ _GLIBCXX_MEM_FN_TRAITS(&&, false_type, true_type) // Call as const, return void template - void - __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, - typename __enable_if_void<_Res>::type = 0) const + __enable_if_void<_Res> + __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) const { _M_f(_Mu<_Bound_args>() (std::get<_Indexes>(_M_bound_args), __args)...); @@ -1046,9 +1045,8 @@ _GLIBCXX_MEM_FN_TRAITS(&&, false_type, true_type) // Call as volatile template - _Result - __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, - typename __disable_if_void<_Res>::type = 0) volatile + __disable_if_void<_Res> + __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) volatile { return _M_f(_Mu<_Bound_args>() (__volget<_Indexes>(_M_bound_args), __args)...); @@ -1056,9 +1054,8 @@ _GLIBCXX_MEM_FN_TRAITS(&&, false_type, true_type) // Call as volatile, return void template - void - __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, - typename __enable_if_void<_Res>::type = 0) volatile + __enable_if_void<_Res> + __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) volatile { _M_f(_Mu<_Bound_args>() (__volget<_Indexes>(_M_bound_args), __args)...); @@ -1066,9 +1063,9 @@ _GLIBCXX_MEM_FN_TRAITS(&&, false_type, true_type) // Call as const volatile template - _Result - __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, - typename __disable_if_void<_Res>::type = 0) const volatile + __disable_if_void<_Res> + __call(tuple<_Args...>&& __args, + _Index_tuple<_Indexes...>) const volatile { return _M_f(_Mu<_Bound_args>() (__volget<_Indexes>(_M_bound_args), __args)...); @@ -1076,10 +1073,9 @@ _GLIBCXX_MEM_FN_TRAITS(&&, false_type, true_type) // Call as const volatile, return void template - void + __enable_if_void<_Res> __call(tuple<_Args...>&& __args, - _Index_tuple<_Indexes...>, - typename __enable_if_void<_Res>::type = 0) const volatile + _Index_tuple<_Indexes...>) const volatile { _M_f(_Mu<_Bound_args>() (__volget<_Indexes>(_M_bound_args), __args)...); -- cgit v1.1