From 6fab1dd801db4c134e9a5ffd77fef9548f0d45f2 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Thu, 26 Jan 2017 10:36:28 +0100 Subject: [PATCH] minor changes --- README.md | 8 ++++---- test/main.cpp | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 1a5dd438..d046caa3 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,10 @@ As an example, a *handle* should be initialized before any other operation and c void listen(uvw::Loop &loop) { std::shared_ptr tcp = loop.resource(); - tcp->once([](const uvw::ListenEvent &, uvw::TcpHandle &srv) mutable { + tcp->once([](const uvw::ListenEvent &, uvw::TcpHandle &srv) { std::shared_ptr client = srv.loop().resource(); - client->on([ptr = srv.shared_from_this()](const uvw::CloseEvent &, uvw::TcpHandle &) mutable { ptr->close(); }); + client->on([ptr = srv.shared_from_this()](const uvw::CloseEvent &, uvw::TcpHandle &) { ptr->close(); }); client->on([](const uvw::EndEvent &, uvw::TcpHandle &client) { client.close(); }); srv.accept(*client); @@ -41,7 +41,7 @@ void conn(uvw::Loop &loop) { tcp->on([](const uvw::ErrorEvent &, uvw::TcpHandle &) { /* handle errors */ }); - tcp->once([](const uvw::ConnectEvent &, uvw::TcpHandle &tcp) mutable { + tcp->once([](const uvw::ConnectEvent &, uvw::TcpHandle &tcp) { auto dataWrite = std::unique_ptr(new char[2]{ 'b', 'c' }); tcp.write(std::move(dataWrite), 2); tcp.close(); @@ -220,7 +220,7 @@ auto tcp = loop.resource(); tcp->on([](const uvw::ErrorEvent &, uvw::TcpHandle &) { /* something went wrong */ }); -tcp->on([](const uvw::ListenEvent &, uvw::TcpHandle &srv) mutable { +tcp->on([](const uvw::ListenEvent &, uvw::TcpHandle &srv) { std::shared_ptr client = srv.loop().resource(); client->once([](const uvw::EndEvent &, uvw::TcpHandle &client) { client.close(); }); client->on([](const uvw::DataEvent &, uvw::TcpHandle &) { /* data received */ }); diff --git a/test/main.cpp b/test/main.cpp index 56c3bb20..9d9df5c4 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -12,7 +12,7 @@ void listen(uvw::Loop &loop) { std::cout << "error " << std::endl; }); - tcp->once([](const uvw::ListenEvent &, uvw::TcpHandle &srv) mutable { + tcp->once([](const uvw::ListenEvent &, uvw::TcpHandle &srv) { std::cout << "listen" << std::endl; std::shared_ptr client = srv.loop().resource(); @@ -21,7 +21,7 @@ void listen(uvw::Loop &loop) { std::cout << "error " << std::endl; }); - client->on([ptr = srv.shared_from_this()](const uvw::CloseEvent &, uvw::TcpHandle &) mutable { + client->on([ptr = srv.shared_from_this()](const uvw::CloseEvent &, uvw::TcpHandle &) { std::cout << "close" << std::endl; ptr->close(); }); @@ -50,7 +50,7 @@ void listen(uvw::Loop &loop) { client->read(); }); - tcp->once([](const uvw::CloseEvent &, uvw::TcpHandle &) mutable { + tcp->once([](const uvw::CloseEvent &, uvw::TcpHandle &) { std::cout << "close" << std::endl; }); @@ -66,12 +66,12 @@ void conn(uvw::Loop &loop) { std::cout << "error " << std::endl; }); - tcp->once([](const uvw::WriteEvent &, uvw::TcpHandle &handle) mutable { + tcp->once([](const uvw::WriteEvent &, uvw::TcpHandle &handle) { std::cout << "write" << std::endl; handle.close(); }); - tcp->once([](const uvw::ConnectEvent &, uvw::TcpHandle &handle) mutable { + tcp->once([](const uvw::ConnectEvent &, uvw::TcpHandle &handle) { std::cout << "connect" << std::endl; auto dataTryWrite = std::unique_ptr(new char[1]{ 'a' }); @@ -82,7 +82,7 @@ void conn(uvw::Loop &loop) { handle.write(std::move(dataWrite), 2); }); - tcp->once([](const uvw::CloseEvent &, uvw::TcpHandle &) mutable { + tcp->once([](const uvw::CloseEvent &, uvw::TcpHandle &) { std::cout << "close" << std::endl; });