[libcxx] LWG2420 bits for bind<void> - Patch from K-Ballo
Implemented LWG2420 bits for bind<void> Review: http://reviews.llvm.org/D10997 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@241967 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8f7fe5cd8e
commit
f301a117e1
@ -2091,14 +2091,16 @@ public:
|
|||||||
result_type
|
result_type
|
||||||
operator()(_Args&& ...__args)
|
operator()(_Args&& ...__args)
|
||||||
{
|
{
|
||||||
return base::operator()(_VSTD::forward<_Args>(__args)...);
|
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
|
||||||
|
return _Invoker::__call(static_cast<base&>(*this), _VSTD::forward<_Args>(__args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ..._Args>
|
template <class ..._Args>
|
||||||
result_type
|
result_type
|
||||||
operator()(_Args&& ...__args) const
|
operator()(_Args&& ...__args) const
|
||||||
{
|
{
|
||||||
return base::operator()(_VSTD::forward<_Args>(__args)...);
|
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
|
||||||
|
return _Invoker::__call(static_cast<base const&>(*this), _VSTD::forward<_Args>(__args)...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2186,12 +2186,13 @@ public:
|
|||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
is_convertible<typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type,
|
is_convertible<typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type,
|
||||||
result_type>::value,
|
result_type>::value || is_void<_Rp>::value,
|
||||||
result_type
|
result_type
|
||||||
>::type
|
>::type
|
||||||
operator()(_Args&& ...__args)
|
operator()(_Args&& ...__args)
|
||||||
{
|
{
|
||||||
return base::operator()(_VSTD::forward<_Args>(__args)...);
|
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
|
||||||
|
return _Invoker::__call(static_cast<base&>(*this), _VSTD::forward<_Args>(__args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ..._Args>
|
template <class ..._Args>
|
||||||
@ -2199,12 +2200,13 @@ public:
|
|||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
is_convertible<typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type,
|
is_convertible<typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type,
|
||||||
result_type>::value,
|
result_type>::value || is_void<_Rp>::value,
|
||||||
result_type
|
result_type
|
||||||
>::type
|
>::type
|
||||||
operator()(_Args&& ...__args) const
|
operator()(_Args&& ...__args) const
|
||||||
{
|
{
|
||||||
return base::operator()(_VSTD::forward<_Args>(__args)...);
|
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
|
||||||
|
return _Invoker::__call(static_cast<base const&>(*this), _VSTD::forward<_Args>(__args)...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -39,21 +39,34 @@ test_const(const F& f)
|
|||||||
|
|
||||||
void f() {++count;}
|
void f() {++count;}
|
||||||
|
|
||||||
struct A_int_0
|
int g() {++count; return 0;}
|
||||||
|
|
||||||
|
struct A_void_0
|
||||||
{
|
{
|
||||||
void operator()() {++count;}
|
void operator()() {++count;}
|
||||||
void operator()() const {count += 2;}
|
void operator()() const {count += 2;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct A_int_0
|
||||||
|
{
|
||||||
|
int operator()() {++count; return 4;}
|
||||||
|
int operator()() const {count += 2; return 5;}
|
||||||
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
test(std::bind(f));
|
test(std::bind(f));
|
||||||
test(std::bind(&f));
|
test(std::bind(&f));
|
||||||
test(std::bind(A_int_0()));
|
test(std::bind(A_void_0()));
|
||||||
test_const(std::bind(A_int_0()));
|
test_const(std::bind(A_void_0()));
|
||||||
|
|
||||||
test(std::bind<void>(f));
|
test(std::bind<void>(f));
|
||||||
test(std::bind<void>(&f));
|
test(std::bind<void>(&f));
|
||||||
|
test(std::bind<void>(A_void_0()));
|
||||||
|
test_const(std::bind<void>(A_void_0()));
|
||||||
|
|
||||||
|
test(std::bind<void>(g));
|
||||||
|
test(std::bind<void>(&g));
|
||||||
test(std::bind<void>(A_int_0()));
|
test(std::bind<void>(A_int_0()));
|
||||||
test_const(std::bind<void>(A_int_0()));
|
test_const(std::bind<void>(A_int_0()));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user