mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 21:07:26 +02:00
is_invocable works with move-only types:
fix #652 Previously reported that function objects taking move only types by value were not invocable.
This commit is contained in:
committed by
Vinnie Falco
parent
2ea3240ed6
commit
27d070c724
@ -1,4 +1,5 @@
|
|||||||
* Documentation tidying
|
* Documentation tidying
|
||||||
|
* is_invocable works with move-only types
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
// A few workarounds to keep things working
|
// A few workarounds to keep things working
|
||||||
|
|
||||||
@ -108,7 +109,7 @@ template<class R, class C, class ...A>
|
|||||||
auto
|
auto
|
||||||
is_invocable_test(C&& c, int, A&& ...a)
|
is_invocable_test(C&& c, int, A&& ...a)
|
||||||
-> decltype(std::is_convertible<
|
-> decltype(std::is_convertible<
|
||||||
decltype(c(a...)), R>::value ||
|
decltype(c(std::forward<A>(a)...)), R>::value ||
|
||||||
std::is_same<R, void>::value,
|
std::is_same<R, void>::value,
|
||||||
std::true_type());
|
std::true_type());
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <boost/asio/ip/tcp.hpp>
|
#include <boost/asio/ip/tcp.hpp>
|
||||||
#include <boost/asio/streambuf.hpp>
|
#include <boost/asio/streambuf.hpp>
|
||||||
#include <boost/asio/detail/consuming_buffers.hpp>
|
#include <boost/asio/detail/consuming_buffers.hpp>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|
||||||
@ -37,6 +38,11 @@ struct is_invocable_udt3
|
|||||||
int operator()(int);
|
int operator()(int);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct is_invocable_udt4
|
||||||
|
{
|
||||||
|
void operator()(std::unique_ptr<int>);
|
||||||
|
};
|
||||||
|
|
||||||
#ifndef __INTELLISENSE__
|
#ifndef __INTELLISENSE__
|
||||||
// VFALCO Fails to compile with Intellisense
|
// VFALCO Fails to compile with Intellisense
|
||||||
BOOST_STATIC_ASSERT(is_invocable<is_invocable_udt1, void(int)>::value);
|
BOOST_STATIC_ASSERT(is_invocable<is_invocable_udt1, void(int)>::value);
|
||||||
@ -46,6 +52,7 @@ BOOST_STATIC_ASSERT(! is_invocable<is_invocable_udt1, void(void)>::value);
|
|||||||
BOOST_STATIC_ASSERT(! is_invocable<is_invocable_udt2, int(void)>::value);
|
BOOST_STATIC_ASSERT(! is_invocable<is_invocable_udt2, int(void)>::value);
|
||||||
BOOST_STATIC_ASSERT(! is_invocable<is_invocable_udt2, void(void)>::value);
|
BOOST_STATIC_ASSERT(! is_invocable<is_invocable_udt2, void(void)>::value);
|
||||||
BOOST_STATIC_ASSERT(! is_invocable<is_invocable_udt3 const, int(int)>::value);
|
BOOST_STATIC_ASSERT(! is_invocable<is_invocable_udt3 const, int(int)>::value);
|
||||||
|
BOOST_STATIC_ASSERT(is_invocable<is_invocable_udt4, void(std::unique_ptr<int>)>::value);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Reference in New Issue
Block a user