From 022fb649b6c465c0b6a6de5bd113e9128f87a422 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 0ca5eb8c61..71754d1f82 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::@executor@ 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 (const auto & clazz : classes) { std::string name = clazz.c_str(); @@ -59,8 +58,6 @@ int main(int argc, char * argv[]) exec.add_node(node); } } - loaders.push_back(loader); - exec.spin();