2010-05-11 19:42:16 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2010-05-11 21:36:01 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
2010-05-11 19:42:16 +00:00
|
|
|
//
|
2010-11-16 22:09:02 +00:00
|
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
// Source Licenses. See LICENSE.TXT for details.
|
2010-05-11 19:42:16 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef _LIBCPP_FUNCTIONAL_BASE_03
|
|
|
|
#define _LIBCPP_FUNCTIONAL_BASE_03
|
|
|
|
|
|
|
|
// manual variadic expansion for <functional>
|
|
|
|
|
|
|
|
// __invoke
|
|
|
|
// first bullet
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(), _T1& __t1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return (__t1.*__f)();
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0), _T1& __t1, _A0& __a0)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return (__t1.*__f)(__a0);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0, _A1), _T1& __t1, _A0& __a0, _A1& __a1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return (__t1.*__f)(__a0, __a1);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2), _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return (__t1.*__f)(__a0, __a1, __a2);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)() const, _T1& __t1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return (__t1.*__f)();
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0) const, _T1& __t1, _A0& __a0)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return (__t1.*__f)(__a0);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0, _A1) const, _T1& __t1, _A0& __a0, _A1& __a1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return (__t1.*__f)(__a0, __a1);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return (__t1.*__f)(__a0, __a1, __a2);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)() volatile, _T1& __t1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return (__t1.*__f)();
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0) volatile, _T1& __t1, _A0& __a0)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return (__t1.*__f)(__a0);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0, _A1) volatile, _T1& __t1, _A0& __a0, _A1& __a1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return (__t1.*__f)(__a0, __a1);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) volatile, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return (__t1.*__f)(__a0, __a1, __a2);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)() const volatile, _T1& __t1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return (__t1.*__f)();
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0) const volatile, _T1& __t1, _A0& __a0)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return (__t1.*__f)(__a0);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0, _A1) const volatile, _T1& __t1, _A0& __a0, _A1& __a1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return (__t1.*__f)(__a0, __a1);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const volatile, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return (__t1.*__f)(__a0, __a1, __a2);
|
|
|
|
}
|
|
|
|
|
|
|
|
// second bullet
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
!is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(), _T1 __t1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return ((*__t1).*__f)();
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
!is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0), _T1 __t1, _A0& __a0)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return ((*__t1).*__f)(__a0);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
!is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0, _A1), _T1 __t1, _A0& __a0, _A1& __a1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return ((*__t1).*__f)(__a0, __a1);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
!is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2), _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return ((*__t1).*__f)(__a0, __a1, __a2);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
!is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)() const, _T1 __t1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return ((*__t1).*__f)();
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
!is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0) const, _T1 __t1, _A0& __a0)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return ((*__t1).*__f)(__a0);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
!is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0, _A1) const, _T1 __t1, _A0& __a0, _A1& __a1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return ((*__t1).*__f)(__a0, __a1);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
!is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return ((*__t1).*__f)(__a0, __a1, __a2);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
!is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)() volatile, _T1 __t1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return ((*__t1).*__f)();
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
!is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0) volatile, _T1 __t1, _A0& __a0)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return ((*__t1).*__f)(__a0);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
!is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0, _A1) volatile, _T1 __t1, _A0& __a0, _A1& __a1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return ((*__t1).*__f)(__a0, __a1);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
!is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) volatile, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return ((*__t1).*__f)(__a0, __a1, __a2);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
!is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)() const volatile, _T1 __t1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return ((*__t1).*__f)();
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
!is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0) const volatile, _T1 __t1, _A0& __a0)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return ((*__t1).*__f)(__a0);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
!is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0, _A1) const volatile, _T1 __t1, _A0& __a0, _A1& __a1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return ((*__t1).*__f)(__a0, __a1);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2011-11-29 18:15:50 +00:00
|
|
|
!is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
|
|
|
_Rp
|
2010-05-11 19:42:16 +00:00
|
|
|
>::type
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const volatile, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return ((*__t1).*__f)(__a0, __a1, __a2);
|
|
|
|
}
|
|
|
|
|
|
|
|
// third bullet
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
typename enable_if
|
|
|
|
<
|
2015-07-28 02:15:53 +00:00
|
|
|
is_member_object_pointer<_Rp _Tp::*>::value &&
|
2011-11-29 18:15:50 +00:00
|
|
|
is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
|
2015-07-28 02:15:53 +00:00
|
|
|
__apply_cv<_T1, _Rp>
|
|
|
|
>::type::type&
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp _Tp::* __f, _T1& __t1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return __t1.*__f;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// forth bullet
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _T1, class _Rp, bool>
|
2010-05-11 19:42:16 +00:00
|
|
|
struct __4th_helper
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _T1, class _Rp>
|
|
|
|
struct __4th_helper<_T1, _Rp, true>
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
2015-07-28 01:52:08 +00:00
|
|
|
typedef typename __apply_cv<decltype(*_VSTD::declval<_T1&>()), _Rp>::type type;
|
2010-05-11 19:42:16 +00:00
|
|
|
};
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _T1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2011-11-29 18:15:50 +00:00
|
|
|
typename __4th_helper<_T1, _Rp,
|
2015-07-28 02:15:53 +00:00
|
|
|
is_member_object_pointer<_Rp _Tp::*>::value &&
|
|
|
|
!is_base_of<_Tp, typename remove_reference<_T1>::type>::value
|
|
|
|
>::type&
|
2011-11-29 18:15:50 +00:00
|
|
|
__invoke(_Rp _Tp::* __f, _T1& __t1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return (*__t1).*__f;
|
|
|
|
}
|
|
|
|
|
|
|
|
// fifth bullet
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Fp>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2015-07-28 01:52:08 +00:00
|
|
|
decltype(_VSTD::declval<_Fp&>()())
|
|
|
|
__invoke(_Fp& __f)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return __f();
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Fp, class _A0>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2015-07-28 01:52:08 +00:00
|
|
|
decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>()))
|
|
|
|
__invoke(_Fp& __f, _A0& __a0)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return __f(__a0);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Fp, class _A0, class _A1>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2015-07-28 01:52:08 +00:00
|
|
|
decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>(), _VSTD::declval<_A1&>()))
|
|
|
|
__invoke(_Fp& __f, _A0& __a0, _A1& __a1)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return __f(__a0, __a1);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Fp, class _A0, class _A1, class _A2>
|
2010-05-11 19:42:16 +00:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
2015-07-28 01:52:08 +00:00
|
|
|
decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>(), _VSTD::declval<_A1&>(), _VSTD::declval<_A2&>()))
|
|
|
|
__invoke(_Fp& __f, _A0& __a0, _A1& __a1, _A2& __a2)
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
|
|
|
return __f(__a0, __a1, __a2);
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Fp, bool = __has_result_type<__weak_result_type<_Fp> >::value>
|
2010-05-11 19:42:16 +00:00
|
|
|
struct __invoke_return
|
|
|
|
{
|
2011-11-29 18:15:50 +00:00
|
|
|
typedef typename __weak_result_type<_Fp>::result_type type;
|
2010-05-11 19:42:16 +00:00
|
|
|
};
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Fp>
|
|
|
|
struct __invoke_return<_Fp, false>
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
2015-07-28 01:52:08 +00:00
|
|
|
typedef decltype(__invoke(_VSTD::declval<_Fp&>())) type;
|
2010-05-11 19:42:16 +00:00
|
|
|
};
|
|
|
|
|
2015-07-28 02:15:53 +00:00
|
|
|
template <class _Tp, class _A0, bool = is_member_object_pointer<_Tp>::value>
|
2010-05-11 19:42:16 +00:00
|
|
|
struct __invoke_return0
|
|
|
|
{
|
2015-07-28 01:52:08 +00:00
|
|
|
typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>())) type;
|
2010-05-11 19:42:16 +00:00
|
|
|
};
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _A0>
|
2015-07-28 02:15:53 +00:00
|
|
|
struct __invoke_return0<_Rp _Tp::*, _A0, true>
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
2011-11-29 18:15:50 +00:00
|
|
|
typedef typename __apply_cv<_A0, _Rp>::type& type;
|
2010-05-11 19:42:16 +00:00
|
|
|
};
|
|
|
|
|
2011-11-29 18:15:50 +00:00
|
|
|
template <class _Rp, class _Tp, class _A0>
|
2015-07-28 02:15:53 +00:00
|
|
|
struct __invoke_return0<_Rp _Tp::*, _A0*, true>
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
2011-11-29 18:15:50 +00:00
|
|
|
typedef typename __apply_cv<_A0, _Rp>::type& type;
|
2010-05-11 19:42:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template <class _Tp, class _A0, class _A1>
|
|
|
|
struct __invoke_return1
|
|
|
|
{
|
2015-07-28 01:52:08 +00:00
|
|
|
typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>(),
|
|
|
|
_VSTD::declval<_A1&>())) type;
|
2010-05-11 19:42:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template <class _Tp, class _A0, class _A1, class _A2>
|
|
|
|
struct __invoke_return2
|
|
|
|
{
|
2015-07-28 01:52:08 +00:00
|
|
|
typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>(),
|
|
|
|
_VSTD::declval<_A1&>(),
|
|
|
|
_VSTD::declval<_A2&>())) type;
|
2010-05-11 19:42:16 +00:00
|
|
|
};
|
|
|
|
|
2010-08-22 00:02:43 +00:00
|
|
|
#endif // _LIBCPP_FUNCTIONAL_BASE_03
|