Summary:
It seems we might avoid temporaries. To do so we pass arguments
directly to constructors with the help of emplace_back member.
Test Plan:
all folly/tests, make check for 37 tests, passed.
Closes https://github.com/facebook/folly/pull/150
Reviewed By: ldbrandy@fb.com
Subscribers: lins, anca, folly-diffs@, yfeldblum
FB internal diff:
D1912505
Signature: t1:
1912505:
1426268158:
086882bb53f3d79c3f3b7b2c362318f09b5ee3be
address.setFromLocalAddress(fd);
setupSocket(fd);
address.setFromLocalAddress(fd);
setupSocket(fd);
- sockets_.push_back(
- ServerEventHandler(eventBase_, fd, this, address.getFamily()));
+ sockets_.emplace_back(eventBase_, fd, this, address.getFamily());
sockets_.back().changeHandlerFD(fd);
}
}
sockets_.back().changeHandlerFD(fd);
}
}
// If we just created this socket, update the EventHandler and set socket_
if (!isExistingSocket) {
// If we just created this socket, update the EventHandler and set socket_
if (!isExistingSocket) {
- sockets_.push_back(
- ServerEventHandler(eventBase_, fd, this, address.getFamily()));
+ sockets_.emplace_back(eventBase_, fd, this, address.getFamily());
SocketAddress address;
address.setFromLocalAddress(s);
SocketAddress address;
address.setFromLocalAddress(s);
- sockets_.push_back(
- ServerEventHandler(eventBase_, s, this, address.getFamily()));
+ sockets_.emplace_back(eventBase_, s, this, address.getFamily());
// Bind to the socket
if (::bind(s, res->ai_addr, res->ai_addrlen) != 0) {
// Bind to the socket
if (::bind(s, res->ai_addr, res->ai_addrlen) != 0) {
eventBase = eventBase_; // Run in AsyncServerSocket's eventbase
}
eventBase = eventBase_; // Run in AsyncServerSocket's eventbase
}
- callbacks_.push_back(CallbackInfo(callback, eventBase));
+ callbacks_.emplace_back(callback, eventBase);
// Start the remote acceptor.
//
// Start the remote acceptor.
//