From 3233f03f295c6a86ff7cf281d117f71608e4af35 Mon Sep 17 00:00:00 2001 From: Chen Lihui Date: Fri, 16 Sep 2022 14:47:25 +0800 Subject: [PATCH] use unique ptr and remove unuseful container Signed-off-by: Chen Lihui --- 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();