diff --git a/CHANGELOG.md b/CHANGELOG.md index f65a4738..f84aab49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ * Documentation tidying +* is_invocable works with move-only types -------------------------------------------------------------------------------- diff --git a/include/beast/core/detail/type_traits.hpp b/include/beast/core/detail/type_traits.hpp index e375b976..5432bf8a 100644 --- a/include/beast/core/detail/type_traits.hpp +++ b/include/beast/core/detail/type_traits.hpp @@ -15,6 +15,7 @@ #include #include #include +#include // A few workarounds to keep things working @@ -108,7 +109,7 @@ template auto is_invocable_test(C&& c, int, A&& ...a) -> decltype(std::is_convertible< - decltype(c(a...)), R>::value || + decltype(c(std::forward(a)...)), R>::value || std::is_same::value, std::true_type()); diff --git a/test/core/type_traits.cpp b/test/core/type_traits.cpp index 4706155b..3aaae4a4 100644 --- a/test/core/type_traits.cpp +++ b/test/core/type_traits.cpp @@ -11,6 +11,7 @@ #include #include #include +#include namespace beast { @@ -37,6 +38,11 @@ struct is_invocable_udt3 int operator()(int); }; +struct is_invocable_udt4 +{ + void operator()(std::unique_ptr); +}; + #ifndef __INTELLISENSE__ // VFALCO Fails to compile with Intellisense BOOST_STATIC_ASSERT(is_invocable::value); @@ -46,6 +52,7 @@ BOOST_STATIC_ASSERT(! is_invocable::value); BOOST_STATIC_ASSERT(! is_invocable::value); BOOST_STATIC_ASSERT(! is_invocable::value); BOOST_STATIC_ASSERT(! is_invocable::value); +BOOST_STATIC_ASSERT(is_invocable)>::value); #endif //