Skip to content

Commit a5cb138

Browse files
committed
replacing boost::bind by std::bind
boost::bind is still used in the test cases, which seem not affected by this change (e.g. no further failures)
1 parent 078542e commit a5cb138

File tree

4 files changed

+22
-20
lines changed

4 files changed

+22
-20
lines changed

concurrency/test/thread_pool_test.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
#include <gtest/gtest.h>
1010
#include <network/concurrency/thread_pool.hpp>
11-
#include <boost/bind.hpp>
11+
// #include <boost/bind.hpp>
12+
#include <functional>
1213

1314
using network::concurrency::thread_pool;
1415

@@ -37,8 +38,8 @@ TEST(concurrency_test, post_work) {
3738
foo instance;
3839
{
3940
thread_pool pool;
40-
ASSERT_NO_THROW(pool.post(boost::bind(&foo::bar, &instance, 1)));
41-
ASSERT_NO_THROW(pool.post(boost::bind(&foo::bar, &instance, 2)));
41+
ASSERT_NO_THROW(pool.post(std::bind(&foo::bar, &instance, 1)));
42+
ASSERT_NO_THROW(pool.post(std::bind(&foo::bar, &instance, 2)));
4243
// require that pool is destroyed here, RAII baby
4344
}
4445
ASSERT_EQ(instance.val(), 3);

contrib/http_examples/http/fileserver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ struct connection_handler : std::enable_shared_from_this<connection_handler> {
143143
connection->write(boost::asio::const_buffers_1(
144144
static_cast<char const*>(mmaped_region.first) + offset,
145145
rightmost_bound),
146-
boost::bind(&connection_handler::handle_chunk,
146+
std::bind(&connection_handler::handle_chunk,
147147
connection_handler::shared_from_this(),
148148
mmaped_region,
149149
rightmost_bound,

http/src/network/protocol/http/server/connection/async.hpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
#include <vector>
3333
#include <iterator>
3434
#include <mutex>
35-
#include <boost/bind.hpp>
35+
// #include <boost/bind.hpp>
36+
#include <functional>
3637
#include <network/constants.hpp>
3738

3839
#ifndef NETWORK_HTTP_SERVER_CONNECTION_HEADER_BUFFER_MAX_SIZE
@@ -213,7 +214,7 @@ class async_server_connection
213214
}
214215

215216
write_headers_only(
216-
boost::bind(&async_server_connection::do_nothing,
217+
std::bind(&async_server_connection::do_nothing,
217218
async_server_connection::shared_from_this()));
218219
}
219220

@@ -279,7 +280,7 @@ class async_server_connection
279280
input_range input = boost::make_iterator_range(new_start,
280281
read_buffer_.end());
281282
thread_pool()
282-
.post(boost::bind(callback,
283+
.post(std::bind(callback,
283284
input,
284285
boost::system::error_code(),
285286
std::distance(new_start, data_end),
@@ -290,7 +291,7 @@ class async_server_connection
290291

291292
socket().async_read_some(
292293
boost::asio::buffer(read_buffer_),
293-
strand.wrap(boost::bind(&async_server_connection::wrap_read_handler,
294+
strand.wrap(std::bind(&async_server_connection::wrap_read_handler,
294295
async_server_connection::shared_from_this(),
295296
callback,
296297
boost::asio::placeholders::error,
@@ -315,7 +316,7 @@ class async_server_connection
315316
data_end = read_buffer_.begin();
316317
std::advance(data_end, bytes_transferred);
317318
thread_pool()
318-
.post(boost::bind(callback,
319+
.post(std::bind(callback,
319320
boost::make_iterator_range(data_start, data_end),
320321
ec,
321322
bytes_transferred,
@@ -371,7 +372,7 @@ class async_server_connection
371372
void read_more(state_t state) {
372373
socket_.async_read_some(
373374
boost::asio::buffer(read_buffer_),
374-
strand.wrap(boost::bind(&async_server_connection::handle_read_data,
375+
strand.wrap(std::bind(&async_server_connection::handle_read_data,
375376
async_server_connection::shared_from_this(),
376377
state,
377378
boost::asio::placeholders::error,
@@ -473,7 +474,7 @@ class async_server_connection
473474
}
474475
new_start = boost::end(result_range);
475476
thread_pool()
476-
.post(boost::bind(handler,
477+
.post(std::bind(handler,
477478
boost::cref(request_),
478479
async_server_connection::shared_from_this()));
479480
return;
@@ -502,7 +503,7 @@ class async_server_connection
502503
boost::asio::async_write(
503504
socket(),
504505
boost::asio::buffer(bad_request, strlen(bad_request)),
505-
strand.wrap(boost::bind(&async_server_connection::client_error_sent,
506+
strand.wrap(std::bind(&async_server_connection::client_error_sent,
506507
async_server_connection::shared_from_this(),
507508
boost::asio::placeholders::error,
508509
boost::asio::placeholders::bytes_transferred)));
@@ -528,7 +529,7 @@ class async_server_connection
528529
boost::asio::async_write(
529530
socket(),
530531
headers_buffer,
531-
strand.wrap(boost::bind(&async_server_connection::handle_write_headers,
532+
strand.wrap(std::bind(&async_server_connection::handle_write_headers,
532533
async_server_connection::shared_from_this(),
533534
callback,
534535
boost::asio::placeholders::error,
@@ -561,7 +562,7 @@ class async_server_connection
561562
boost::system::error_code const& ec,
562563
std::size_t bytes_transferred) {
563564
// we want to forget the temporaries and buffers
564-
thread_pool().post(boost::bind(callback, ec));
565+
thread_pool().post(std::bind(callback, ec));
565566
}
566567

567568
template <class Range>
@@ -621,7 +622,7 @@ class async_server_connection
621622
std::function<void(boost::system::error_code)> callback_function = callback;
622623

623624
std::function<void()> continuation =
624-
boost::bind(
625+
std::bind(
625626
&async_server_connection::template write_vec_impl<
626627
ConstBufferSeq,
627628
std::function<void(
@@ -643,7 +644,7 @@ class async_server_connection
643644
boost::asio::async_write(
644645
socket_,
645646
seq,
646-
boost::bind(&async_server_connection::handle_write,
647+
std::bind(&async_server_connection::handle_write,
647648
async_server_connection::shared_from_this(),
648649
callback_function,
649650
temporaries,

http/src/network/protocol/http/server/connection/sync.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class sync_server_connection
6464
<< socket_.remote_endpoint().port();
6565
request_.set_source(ip_stream.str());
6666
socket_.async_read_some(boost::asio::buffer(read_buffer_),
67-
wrapper_.wrap(boost::bind(
67+
wrapper_.wrap(std::bind(
6868
&sync_server_connection::handle_read_data,
6969
sync_server_connection::shared_from_this(),
7070
method,
@@ -196,7 +196,7 @@ class sync_server_connection
196196
socket_,
197197
response_buffers,
198198
wrapper_.wrap(
199-
boost::bind(&sync_server_connection::handle_write,
199+
std::bind(&sync_server_connection::handle_write,
200200
sync_server_connection::shared_from_this(),
201201
boost::asio::placeholders::error)));
202202
}
@@ -235,7 +235,7 @@ class sync_server_connection
235235
socket(),
236236
boost::asio::buffer(bad_request, strlen(bad_request)),
237237
wrapper_.wrap(
238-
boost::bind(&sync_server_connection::client_error_sent,
238+
std::bind(&sync_server_connection::client_error_sent,
239239
sync_server_connection::shared_from_this(),
240240
boost::asio::placeholders::error,
241241
boost::asio::placeholders::bytes_transferred)));
@@ -254,7 +254,7 @@ class sync_server_connection
254254

255255
void read_more(state_t state) {
256256
socket_.async_read_some(boost::asio::buffer(read_buffer_),
257-
wrapper_.wrap(boost::bind(
257+
wrapper_.wrap(std::bind(
258258
&sync_server_connection::handle_read_data,
259259
sync_server_connection::shared_from_this(),
260260
state,

0 commit comments

Comments
 (0)