example/cppcon2018 only requires C++11

This commit is contained in:
Vinnie Falco
2018-11-22 17:28:57 -08:00
parent cf6021a355
commit a5d5c7500a
4 changed files with 39 additions and 38 deletions

View File

@@ -1,6 +1,7 @@
Version 190: Version 190:
* Fix broken doc link * Fix broken doc link
* example/cppcon2018 only requires C++11
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@@ -203,11 +203,11 @@ run()
{ {
// Read a request // Read a request
http::async_read(socket_, buffer_, req_, http::async_read(socket_, buffer_, req_,
[self = shared_from_this()] std::bind(
(error_code ec, std::size_t bytes) &http_session::on_read,
{ shared_from_this(),
self->on_read(ec, bytes); std::placeholders::_1,
}); std::placeholders::_2));
} }
// Report a failure // Report a failure
@@ -341,9 +341,9 @@ on_write(error_code ec, std::size_t, bool close)
// Read another request // Read another request
http::async_read(socket_, buffer_, req_, http::async_read(socket_, buffer_, req_,
[self = shared_from_this()] std::bind(
(error_code ec, std::size_t bytes) &http_session::on_read,
{ shared_from_this(),
self->on_read(ec, bytes); std::placeholders::_1,
}); std::placeholders::_2));
} }

View File

@@ -63,10 +63,10 @@ run()
// Start accepting a connection // Start accepting a connection
acceptor_.async_accept( acceptor_.async_accept(
socket_, socket_,
[self = shared_from_this()](error_code ec) std::bind(
{ &listener::on_accept,
self->on_accept(ec); shared_from_this(),
}); std::placeholders::_1));
} }
// Report a failure // Report a failure
@@ -96,8 +96,8 @@ on_accept(error_code ec)
// Accept another connection // Accept another connection
acceptor_.async_accept( acceptor_.async_accept(
socket_, socket_,
[self = shared_from_this()](error_code ec) std::bind(
{ &listener::on_accept,
self->on_accept(ec); shared_from_this(),
}); std::placeholders::_1));
} }

View File

@@ -51,11 +51,11 @@ on_accept(error_code ec)
// Read a message // Read a message
ws_.async_read( ws_.async_read(
buffer_, buffer_,
[sp = shared_from_this()]( std::bind(
error_code ec, std::size_t bytes) &websocket_session::on_read,
{ shared_from_this(),
sp->on_read(ec, bytes); std::placeholders::_1,
}); std::placeholders::_2));
} }
void void
@@ -75,11 +75,11 @@ on_read(error_code ec, std::size_t)
// Read another message // Read another message
ws_.async_read( ws_.async_read(
buffer_, buffer_,
[sp = shared_from_this()]( std::bind(
error_code ec, std::size_t bytes) &websocket_session::on_read,
{ shared_from_this(),
sp->on_read(ec, bytes); std::placeholders::_1,
}); std::placeholders::_2));
} }
void void
@@ -96,11 +96,11 @@ send(std::shared_ptr<std::string const> const& ss)
// We are not currently writing, so send this immediately // We are not currently writing, so send this immediately
ws_.async_write( ws_.async_write(
net::buffer(*queue_.front()), net::buffer(*queue_.front()),
[sp = shared_from_this()]( std::bind(
error_code ec, std::size_t bytes) &websocket_session::on_write,
{ shared_from_this(),
sp->on_write(ec, bytes); std::placeholders::_1,
}); std::placeholders::_2));
} }
void void
@@ -118,9 +118,9 @@ on_write(error_code ec, std::size_t)
if(! queue_.empty()) if(! queue_.empty())
ws_.async_write( ws_.async_write(
net::buffer(*queue_.front()), net::buffer(*queue_.front()),
[sp = shared_from_this()]( std::bind(
error_code ec, std::size_t bytes) &websocket_session::on_write,
{ shared_from_this(),
sp->on_write(ec, bytes); std::placeholders::_1,
}); std::placeholders::_2));
} }