diff --git a/include/ascs/object_pool.h b/include/ascs/object_pool.h index f8920e3ddf5293238381e50243f06cba321ffc4e..c4c6dcfe2e201a3f17ddc94828bb1674bd842db6 100644 --- a/include/ascs/object_pool.h +++ b/include/ascs/object_pool.h @@ -156,7 +156,7 @@ protected: if (old_object_ptr && !init_object_id(object_ptr, id)) { std::lock_guard 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(); } diff --git a/include/ascs/service_pump.h b/include/ascs/service_pump.h index 2395aa748cf1e0c63d2f5aaeb702c1fd01ef27a0..491d824da7905038fe45d4268bdedcd6961d8b68 100644 --- a/include/ascs/service_pump.h +++ b/include/ascs/service_pump.h @@ -137,7 +137,7 @@ public: int get_io_context_num() const {return (int) context_can.size();} void get_io_context_refs(std::list& 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 diff --git a/include/ascs/tcp/server.h b/include/ascs/tcp/server.h index 6f83cf81e8bf7c006c99eb51b6c53e59c2303fed..93ef2794da3a0696f9af45f150b59ccb04ebfdeb 100644 --- a/include/ascs/tcp/server.h +++ b/include/ascs/tcp/server.h @@ -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);