Skip to content
This repository was archived by the owner on Jun 12, 2018. It is now read-only.

Commit 32561b1

Browse files
committed
warnings: remove unused captures in lambdas
Found with clang's -Wunused-lambda-capture
1 parent 6192c13 commit 32561b1

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

http_examples.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ int main() {
8989

9090
//GET-example for the path /match/[number], responds with the matched string in path (number)
9191
//For instance a request GET /match/123 will receive: 123
92-
server.resource["^/match/([0-9]+)$"]["GET"]=[&server](shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request) {
92+
server.resource["^/match/([0-9]+)$"]["GET"]=[](shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request) {
9393
string number=request->path_match[1];
9494
*response << "HTTP/1.1 200 OK\r\nContent-Length: " << number.length() << "\r\n\r\n" << number;
9595
};
9696

9797
//Get example simulating heavy work in a separate thread
98-
server.resource["^/work$"]["GET"]=[&server](shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> /*request*/) {
98+
server.resource["^/work$"]["GET"]=[](shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> /*request*/) {
9999
thread work_thread([response] {
100100
this_thread::sleep_for(chrono::seconds(5));
101101
string message="Work done";

https_examples.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ int main() {
8787

8888
//GET-example for the path /match/[number], responds with the matched string in path (number)
8989
//For instance a request GET /match/123 will receive: 123
90-
server.resource["^/match/([0-9]+)$"]["GET"]=[&server](shared_ptr<HttpsServer::Response> response, shared_ptr<HttpsServer::Request> request) {
90+
server.resource["^/match/([0-9]+)$"]["GET"]=[](shared_ptr<HttpsServer::Response> response, shared_ptr<HttpsServer::Request> request) {
9191
string number=request->path_match[1];
9292
*response << "HTTP/1.1 200 OK\r\nContent-Length: " << number.length() << "\r\n\r\n" << number;
9393
};
9494

9595
//Get example simulating heavy work in a separate thread
96-
server.resource["^/work$"]["GET"]=[&server](shared_ptr<HttpsServer::Response> response, shared_ptr<HttpsServer::Request> /*request*/) {
96+
server.resource["^/work$"]["GET"]=[](shared_ptr<HttpsServer::Response> response, shared_ptr<HttpsServer::Request> /*request*/) {
9797
thread work_thread([response] {
9898
this_thread::sleep_for(chrono::seconds(5));
9999
string message="Work done";

server_http.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ namespace SimpleWeb {
217217

218218
///Use this function if you need to recursively send parts of a longer message
219219
void send(const std::shared_ptr<Response> &response, const std::function<void(const boost::system::error_code&)>& callback=nullptr) const {
220-
boost::asio::async_write(*response->socket, response->streambuf, [this, response, callback](const boost::system::error_code& ec, size_t /*bytes_transferred*/) {
220+
boost::asio::async_write(*response->socket, response->streambuf, [callback](const boost::system::error_code& ec, size_t /*bytes_transferred*/) {
221221
if(callback)
222222
callback(ec);
223223
});

0 commit comments

Comments
 (0)