mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-25 18:23:01 +02:00
Problem: use of std::map::insert is inefficient
Solution: use std::map::emplace instead, where available
This commit is contained in:
@@ -1010,14 +1010,14 @@ void zmq::stream_engine_t::set_handshake_timer ()
|
||||
|
||||
bool zmq::stream_engine_t::init_properties (properties_t & properties) {
|
||||
if (peer_address.empty()) return false;
|
||||
properties.insert (
|
||||
std::make_pair (ZMQ_MSG_PROPERTY_PEER_ADDRESS, peer_address));
|
||||
properties.ZMQ_MAP_INSERT_OR_EMPLACE (
|
||||
ZMQ_MSG_PROPERTY_PEER_ADDRESS, peer_address);
|
||||
|
||||
// Private property to support deprecated SRCFD
|
||||
std::ostringstream stream;
|
||||
stream << (int)s;
|
||||
std::string fd_string = stream.str();
|
||||
properties.insert(std::make_pair("__fd", fd_string));
|
||||
properties.ZMQ_MAP_INSERT_OR_EMPLACE ("__fd", ZMQ_MOVE(fd_string));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user