Browse Source

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

Oleg Vorobiov 5 years ago
parent
commit
7b3cea5317
1 changed files with 5 additions and 1 deletions
  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();