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:
Julian Brost 2025-04-15 15:10:12 +02:00 committed by GitHub
parent d1d399f8b3
commit d3fae440d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -105,7 +105,7 @@ public:
template <typename Handler, typename Function>
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 {
f(yc);
} catch (const std::exception& ex) {