mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 22:54:57 +02:00
SpawnCoroutine: move callback into wrapper lambda
f isn't used otherwise in the function, so if possible, it can just be moved into the lambda, avoiding a copy. Co-authored-by: Alexander Aleksandrovič Klimov <alexander.klimov@icinga.com>
This commit is contained in:
parent
d1d399f8b3
commit
d3fae440d4
@ -105,7 +105,7 @@ public:
|
|||||||
|
|
||||||
template <typename Handler, typename Function>
|
template <typename Handler, typename Function>
|
||||||
static void SpawnCoroutine(Handler& h, Function f) {
|
static void SpawnCoroutine(Handler& h, Function f) {
|
||||||
auto wrapper = [f](boost::asio::yield_context yc) {
|
auto wrapper = [f = std::move(f)](boost::asio::yield_context yc) {
|
||||||
try {
|
try {
|
||||||
f(yc);
|
f(yc);
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user