mirror of
https://github.com/boostorg/beast.git
synced 2025-08-02 06:15:24 +02:00
Fix move-only arguments in bind_handler
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
Version 172:
|
Version 172:
|
||||||
|
|
||||||
* Tidy up websocket stream javadocs
|
* Tidy up websocket stream javadocs
|
||||||
|
* Fix move-only arguments in bind_handler
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -51,10 +51,10 @@ class bound_handler
|
|||||||
boost::is_placeholder<typename
|
boost::is_placeholder<typename
|
||||||
std::decay<Arg>::type>::value == 0,
|
std::decay<Arg>::type>::value == 0,
|
||||||
Arg&&>::type
|
Arg&&>::type
|
||||||
extract(Arg&& arg, Vals& vals)
|
extract(Arg&& arg, Vals&& vals)
|
||||||
{
|
{
|
||||||
boost::ignore_unused(vals);
|
boost::ignore_unused(vals);
|
||||||
return arg;
|
return std::forward<Arg>(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Arg, class Vals>
|
template<class Arg, class Vals>
|
||||||
@@ -101,7 +101,7 @@ class bound_handler
|
|||||||
index_sequence<S...>)
|
index_sequence<S...>)
|
||||||
{
|
{
|
||||||
boost::ignore_unused(args);
|
boost::ignore_unused(args);
|
||||||
h(std::get<S>(args)...);
|
h(std::get<S>(std::move(args))...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<
|
template<
|
||||||
@@ -118,7 +118,7 @@ class bound_handler
|
|||||||
{
|
{
|
||||||
boost::ignore_unused(args);
|
boost::ignore_unused(args);
|
||||||
boost::ignore_unused(vals);
|
boost::ignore_unused(vals);
|
||||||
h(extract(std::get<S>(args),
|
h(extract(std::get<S>(std::move(args)),
|
||||||
std::forward<ValsTuple>(vals))...);
|
std::forward<ValsTuple>(vals))...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -81,6 +81,21 @@ public:
|
|||||||
s.wrap(copyable_handler{}));
|
s.wrap(copyable_handler{}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct move_only
|
||||||
|
{
|
||||||
|
move_only() = default;
|
||||||
|
move_only(move_only&&) = default;
|
||||||
|
move_only(move_only const&) = delete;
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
testMoveOnly()
|
||||||
|
{
|
||||||
|
bind_handler([](move_only){}, move_only{})();
|
||||||
|
bind_handler([](move_only){}, std::placeholders::_1)(move_only{});
|
||||||
|
bind_handler([](move_only, move_only){}, move_only{}, std::placeholders::_1)(move_only{});
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
run() override
|
run() override
|
||||||
{
|
{
|
||||||
@@ -90,6 +105,7 @@ public:
|
|||||||
f();
|
f();
|
||||||
testPlaceholders();
|
testPlaceholders();
|
||||||
testAsioHandlerInvoke();
|
testAsioHandlerInvoke();
|
||||||
|
testMoveOnly();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user