From 53cbad15af30d2265d3ba7cbeac78f187af48295 Mon Sep 17 00:00:00 2001 From: Chen Lihui Date: Tue, 20 Sep 2022 01:08:25 +0800 Subject: [PATCH] use unique ptr and remove unuseful container (#2013) Signed-off-by: Chen Lihui Signed-off-by: Chen Lihui (cherry picked from commit 6a8c61c0269187c9505632647f6a9f5698b523e8) --- rclcpp_components/src/node_main.cpp.in | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/rclcpp_components/src/node_main.cpp.in b/rclcpp_components/src/node_main.cpp.in index bfebc4aa7d..367afca7e2 100644 --- a/rclcpp_components/src/node_main.cpp.in +++ b/rclcpp_components/src/node_main.cpp.in @@ -30,14 +30,13 @@ int main(int argc, char * argv[]) rclcpp::executors::SingleThreadedExecutor exec; rclcpp::NodeOptions options; options.arguments(args); - std::vector loaders; std::vector node_wrappers; std::string library_name = "@library_name@"; std::string class_name = "rclcpp_components::NodeFactoryTemplate<@component@>"; RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = new class_loader::ClassLoader(library_name); + auto loader = std::make_unique(library_name); auto classes = loader->getAvailableClasses(); for (auto clazz : classes) { std::string name = clazz.c_str(); @@ -50,8 +49,6 @@ int main(int argc, char * argv[]) exec.add_node(node); } } - loaders.push_back(loader); - exec.spin();