Skip to content

Commit 50b8462

Browse files
committed
fix for cpp11 branch
1 parent ea7f00d commit 50b8462

2 files changed

Lines changed: 22 additions & 24 deletions

File tree

‎examples/protobuf/rpcbalancer/balancer.cc‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,26 @@
77
#include <muduo/net/protorpc/RpcCodec.h>
88
#include <muduo/net/protorpc/rpc.pb.h>
99

10-
#include <boost/bind.hpp>
1110
#include <boost/ptr_container/ptr_vector.hpp>
1211

1312
#include <stdio.h>
1413

1514
using namespace muduo;
1615
using namespace muduo::net;
1716

18-
class BackendSession : boost::noncopyable
17+
class BackendSession : noncopyable
1918
{
2019
public:
2120
BackendSession(EventLoop* loop, const InetAddress& backendAddr, const string& name)
2221
: loop_(loop),
2322
client_(loop, backendAddr, name),
24-
codec_(boost::bind(&BackendSession::onRpcMessage, this, _1, _2, _3)),
23+
codec_(std::bind(&BackendSession::onRpcMessage, this, _1, _2, _3)),
2524
nextId_(0)
2625
{
2726
client_.setConnectionCallback(
28-
boost::bind(&BackendSession::onConnection, this, _1));
27+
std::bind(&BackendSession::onConnection, this, _1));
2928
client_.setMessageCallback(
30-
boost::bind(&RpcCodec::onMessage, &codec_, _1, _2, _3));
29+
std::bind(&RpcCodec::onMessage, &codec_, _1, _2, _3));
3130
client_.enableRetry();
3231
}
3332

@@ -104,7 +103,7 @@ class BackendSession : boost::noncopyable
104103
struct Request
105104
{
106105
uint64_t origId;
107-
boost::weak_ptr<TcpConnection> clientConn;
106+
std::weak_ptr<TcpConnection> clientConn;
108107
};
109108

110109
EventLoop* loop_;
@@ -115,7 +114,7 @@ class BackendSession : boost::noncopyable
115114
std::map<uint64_t, Request> outstandings_;
116115
};
117116

118-
class Balancer : boost::noncopyable
117+
class Balancer : noncopyable
119118
{
120119
public:
121120
Balancer(EventLoop* loop,
@@ -124,15 +123,15 @@ class Balancer : boost::noncopyable
124123
const std::vector<InetAddress>& backends)
125124
: loop_(loop),
126125
server_(loop, listenAddr, name),
127-
codec_(boost::bind(&Balancer::onRpcMessage, this, _1, _2, _3)),
126+
codec_(std::bind(&Balancer::onRpcMessage, this, _1, _2, _3)),
128127
backends_(backends)
129128
{
130129
server_.setThreadInitCallback(
131-
boost::bind(&Balancer::initPerThread, this, _1));
130+
std::bind(&Balancer::initPerThread, this, _1));
132131
server_.setConnectionCallback(
133-
boost::bind(&Balancer::onConnection, this, _1));
132+
std::bind(&Balancer::onConnection, this, _1));
134133
server_.setMessageCallback(
135-
boost::bind(&RpcCodec::onMessage, &codec_, _1, _2, _3));
134+
std::bind(&RpcCodec::onMessage, &codec_, _1, _2, _3));
136135
}
137136

138137
~Balancer()

‎examples/protobuf/rpcbalancer/balancer_raw.cc‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <muduo/net/protorpc/RpcCodec.h>
1010
#include <muduo/net/protorpc/rpc.pb.h>
1111

12-
#include <boost/bind.hpp>
1312
#include <boost/ptr_container/ptr_vector.hpp>
1413

1514
#include <endian.h>
@@ -70,20 +69,20 @@ struct RawMessage
7069
const void* loc_;
7170
};
7271

73-
class BackendSession : boost::noncopyable
72+
class BackendSession : noncopyable
7473
{
7574
public:
7675
BackendSession(EventLoop* loop, const InetAddress& backendAddr, const string& name)
7776
: loop_(loop),
7877
client_(loop, backendAddr, name),
79-
codec_(boost::bind(&BackendSession::onRpcMessage, this, _1, _2, _3),
80-
boost::bind(&BackendSession::onRawMessage, this, _1, _2, _3)),
78+
codec_(std::bind(&BackendSession::onRpcMessage, this, _1, _2, _3),
79+
std::bind(&BackendSession::onRawMessage, this, _1, _2, _3)),
8180
nextId_(0)
8281
{
8382
client_.setConnectionCallback(
84-
boost::bind(&BackendSession::onConnection, this, _1));
83+
std::bind(&BackendSession::onConnection, this, _1));
8584
client_.setMessageCallback(
86-
boost::bind(&RpcCodec::onMessage, &codec_, _1, _2, _3));
85+
std::bind(&RpcCodec::onMessage, &codec_, _1, _2, _3));
8786
client_.enableRetry();
8887
}
8988

@@ -192,7 +191,7 @@ class BackendSession : boost::noncopyable
192191
struct Request
193192
{
194193
uint64_t origId;
195-
boost::weak_ptr<TcpConnection> clientConn;
194+
std::weak_ptr<TcpConnection> clientConn;
196195
};
197196

198197
EventLoop* loop_;
@@ -203,7 +202,7 @@ class BackendSession : boost::noncopyable
203202
std::map<uint64_t, Request> outstandings_;
204203
};
205204

206-
class Balancer : boost::noncopyable
205+
class Balancer : noncopyable
207206
{
208207
public:
209208
Balancer(EventLoop* loop,
@@ -212,16 +211,16 @@ class Balancer : boost::noncopyable
212211
const std::vector<InetAddress>& backends)
213212
: loop_(loop),
214213
server_(loop, listenAddr, name),
215-
codec_(boost::bind(&Balancer::onRpcMessage, this, _1, _2, _3),
216-
boost::bind(&Balancer::onRawMessage, this, _1, _2, _3)),
214+
codec_(std::bind(&Balancer::onRpcMessage, this, _1, _2, _3),
215+
std::bind(&Balancer::onRawMessage, this, _1, _2, _3)),
217216
backends_(backends)
218217
{
219218
server_.setThreadInitCallback(
220-
boost::bind(&Balancer::initPerThread, this, _1));
219+
std::bind(&Balancer::initPerThread, this, _1));
221220
server_.setConnectionCallback(
222-
boost::bind(&Balancer::onConnection, this, _1));
221+
std::bind(&Balancer::onConnection, this, _1));
223222
server_.setMessageCallback(
224-
boost::bind(&RpcCodec::onMessage, &codec_, _1, _2, _3));
223+
std::bind(&RpcCodec::onMessage, &codec_, _1, _2, _3));
225224
}
226225

227226
~Balancer()

0 commit comments

Comments
 (0)