提交 b23d9d58 编写于 作者: Y youngwolf

Replace container insertion push_back with emplace_back.

上级 c38b6a69
......@@ -156,7 +156,7 @@ protected:
if (old_object_ptr && !init_object_id(object_ptr, id))
{
std::lock_guard<std::mutex> lock(invalid_object_can_mutex);
invalid_object_can.push_back(old_object_ptr);
invalid_object_can.emplace_back(old_object_ptr);
old_object_ptr.reset();
}
......
......@@ -137,7 +137,7 @@ public:
int get_io_context_num() const {return (int) context_can.size();}
void get_io_context_refs(std::list<unsigned>& refs)
{if (!single_ctx) ascs::do_something_to_all(context_can, context_can_mutex, [&](context& item) {refs.push_back(item.refs);});}
{if (!single_ctx) ascs::do_something_to_all(context_can, context_can_mutex, [&](context& item) {refs.emplace_back(item.refs);});}
//do not call below function implicitly or explicitly, before 1.6, a service_pump is also an io_context, so we already have it implicitly,
// but in 1.6 and later, a service_pump is not an io_context anymore, then it is just provided to accommodate legacy usage in class
......
......@@ -106,7 +106,7 @@ public:
if (!socket_ptr)
break;
sockets.push_back(std::move(socket_ptr));
sockets.emplace_back(std::move(socket_ptr));
}
if (num >= 0)
unified_out::info_out("finished pre-creating server sockets, but failed %d time(s).", num + 1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册