From d3fae440d4b229581c39bc972ea2f3edf0d23efe Mon Sep 17 00:00:00 2001 From: Julian Brost Date: Tue, 15 Apr 2025 15:10:12 +0200 Subject: [PATCH] SpawnCoroutine: move callback into wrapper lambda MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- lib/base/io-engine.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/base/io-engine.hpp b/lib/base/io-engine.hpp index 2d2c5e922..64831ff8c 100644 --- a/lib/base/io-engine.hpp +++ b/lib/base/io-engine.hpp @@ -105,7 +105,7 @@ public: template 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) {