From 7b3cea5317b663250aeaea0cb6753965a3c9a669 Mon Sep 17 00:00:00 2001 From: Oleg Vorobiov Date: Thu, 12 Mar 2020 23:31:22 +0700 Subject: [PATCH] Prevent an implicit capture of 'this' via '[=]' (#381) --- httplib.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/httplib.h b/httplib.h index e79ae3c..947f08d 100644 --- a/httplib.h +++ b/httplib.h @@ -3390,7 +3390,11 @@ inline bool Server::listen_internal() { break; } - task_queue->enqueue([=]() { process_and_close_socket(sock); }); +#if __cplusplus > 201703L + task_queue->enqueue([=, this]() { process_and_close_socket(sock); }); +#else + task_queue->enqueue([=]() { process_and_close_socket(sock); }); +#endif } task_queue->shutdown();