From: Jonathan Wakely Date: Fri, 14 Oct 2016 09:12:49 +0000 (+0100) Subject: Simplify reference_wrapper nested typedefs X-Git-Tag: upstream/12.2.0~44054 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=57c4fbc64b6c15c43b60a7943422c9ff7010694d;p=platform%2Fupstream%2Fgcc.git Simplify reference_wrapper nested typedefs * include/std/functional (_Reference_wrapper_base_impl): Remove. (_Refwrap_base_arg1, _Refwrap_base_arg2): New helpers using __void_t. (_Reference_wrapper_base): Inherit from new helpers. From-SVN: r241151 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 32b59a3..cd6ac76 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2016-10-14 Jonathan Wakely + + * include/std/functional (_Reference_wrapper_base_impl): Remove. + (_Refwrap_base_arg1, _Refwrap_base_arg2): New helpers using __void_t. + (_Reference_wrapper_base): Inherit from new helpers. + 2016-10-13 Paolo Carlini * testsuite/24_iterators/container_access.cc: Remove 'test' variables. diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional index 8fc60dc..d39b519 100644 --- a/libstdc++-v3/include/std/functional +++ b/libstdc++-v3/include/std/functional @@ -207,51 +207,34 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } #endif - /** - * Knowing which of unary_function and binary_function _Tp derives - * from, derives from the same and ensures that reference_wrapper - * will have a weak result type. See cases below. - */ - template - struct _Reference_wrapper_base_impl; - - // None of the nested argument types. - template - struct _Reference_wrapper_base_impl - : _Weak_result_type<_Tp> + // Detect nested argument_type. + template> + struct _Refwrap_base_arg1 { }; - // Nested argument_type only. + // Nested argument_type. template - struct _Reference_wrapper_base_impl - : _Weak_result_type<_Tp> + struct _Refwrap_base_arg1<_Tp, + __void_t> { typedef typename _Tp::argument_type argument_type; }; - // Nested first_argument_type and second_argument_type only. - template - struct _Reference_wrapper_base_impl - : _Weak_result_type<_Tp> - { - typedef typename _Tp::first_argument_type first_argument_type; - typedef typename _Tp::second_argument_type second_argument_type; - }; + // Detect nested first_argument_type and second_argument_type. + template> + struct _Refwrap_base_arg2 + { }; - // All the nested argument types. - template - struct _Reference_wrapper_base_impl - : _Weak_result_type<_Tp> + // Nested first_argument_type and second_argument_type. + template + struct _Refwrap_base_arg2<_Tp, + __void_t> { - typedef typename _Tp::argument_type argument_type; typedef typename _Tp::first_argument_type first_argument_type; typedef typename _Tp::second_argument_type second_argument_type; }; - _GLIBCXX_HAS_NESTED_TYPE(argument_type) - _GLIBCXX_HAS_NESTED_TYPE(first_argument_type) - _GLIBCXX_HAS_NESTED_TYPE(second_argument_type) - /** * Derives from unary_function or binary_function when it * can. Specializations handle all of the easy cases. The primary @@ -260,11 +243,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ template struct _Reference_wrapper_base - : _Reference_wrapper_base_impl< - __has_argument_type<_Tp>::value, - __has_first_argument_type<_Tp>::value - && __has_second_argument_type<_Tp>::value, - _Tp> + : _Weak_result_type<_Tp>, _Refwrap_base_arg1<_Tp>, _Refwrap_base_arg2<_Tp> { }; // - a function type (unary)