Implement LWG issue 2219 - support reference_wrapper in INVOKE

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@266590 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2016-04-18 06:17:30 +00:00
parent b952822a48
commit 134ff65b8f
11 changed files with 409 additions and 62 deletions

View File

@@ -322,6 +322,17 @@ __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
}
template <class _Fp, class _A0, class ..._Args,
class>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype((__a0.get().*__f)(_VSTD::forward<_Args>(__args)...))
{
return (__a0.get().*__f)(_VSTD::forward<_Args>(__args)...);
}
template <class _Fp, class _A0, class ..._Args,
class>
inline _LIBCPP_INLINE_VISIBILITY
@@ -344,6 +355,17 @@ __invoke(_Fp&& __f, _A0&& __a0)
return _VSTD::forward<_A0>(__a0).*__f;
}
template <class _Fp, class _A0,
class>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0)
-> decltype(__a0.get().*__f)
{
return __a0.get().*__f;
}
template <class _Fp, class _A0,
class>
inline _LIBCPP_INLINE_VISIBILITY
@@ -577,10 +599,6 @@ public:
#endif // _LIBCPP_HAS_NO_VARIADICS
};
template <class _Tp> struct __is_reference_wrapper_impl : public false_type {};
template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {};
template <class _Tp> struct __is_reference_wrapper
: public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {};
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY