Explorar o código

Prevent an implicit capture of 'this' via '[=]' (#381)

Oleg Vorobiov %!s(int64=5) %!d(string=hai) anos
pai
achega
7b3cea5317
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      httplib.h

+ 5 - 1
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();