diff --git a/include/ascs/object_pool.h b/include/ascs/object_pool.h index 451c27387595e3991d56f3c00ce4859999e500bf..e6f598d8391595bfa5cae85303cbec0ac39ff246 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 2a7e3c2f03fe9996e095ffe0bb1c329fd39e2ae2..4beb7b69062352d031ab42aa4cd10f7ceed62d70 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 13abaa0c66cf69252f1e30568bffaedc8ecf9aa8..aa498379252d2514ae2c1dfcd510fa1a097d8ecf 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);