Skip to content

Commit

Permalink
Do not use boost::move in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
apolukhin committed Dec 15, 2024
1 parent b42fdd8 commit 29a15f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion example/tutorial3/tutorial3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ std::size_t search_for_symbols(const std::vector<boost::dll::fs::path>& plugins)
// library has symbol, importing...
typedef boost::shared_ptr<my_plugin_api> (pluginapi_create_t)();
boost::function<pluginapi_create_t> creator
= dll::import_alias<pluginapi_create_t>(boost::move(lib), "create_plugin");
= dll::import_alias<pluginapi_create_t>(std::move(lib), "create_plugin");

std::cout << "Matching plugin name: " << creator()->name() << std::endl;
++ plugins_found;
Expand Down
10 changes: 5 additions & 5 deletions example/tutorial5/load_all.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class plugins_collector {

// Gets `my_plugin_api` instance using "create_plugin" or "plugin" imports,
// stores plugin with its name in the `plugins_` map.
void insert_plugin(BOOST_RV_REF(dll::shared_library) lib);
void insert_plugin(dll::shared_library&& lib);

public:
plugins_collector(const boost::dll::fs::path& plugins_directory)
Expand Down Expand Up @@ -75,17 +75,17 @@ void plugins_collector::load_all() {
std::cout << "Loaded (" << plugin.native() << "):" << it->path() << '\n';

// Gets plugin using "create_plugin" or "plugin" function
insert_plugin(boost::move(plugin));
insert_plugin(std::move(plugin));
}

dll::shared_library plugin(dll::program_location());
std::cout << "Loaded self\n";
insert_plugin(boost::move(plugin));
insert_plugin(std::move(plugin));
}
//]

//[plugcpp_plugins_collector_insert_plugin
void plugins_collector::insert_plugin(BOOST_RV_REF(dll::shared_library) lib) {
void plugins_collector::insert_plugin(dll::shared_library&& lib) {
std::string plugin_name;
if (lib.has("create_plugin")) {
plugin_name = lib.get_alias<boost::shared_ptr<my_plugin_api>()>("create_plugin")()->name();
Expand All @@ -96,7 +96,7 @@ void plugins_collector::insert_plugin(BOOST_RV_REF(dll::shared_library) lib) {
}

if (plugins_.find(plugin_name) == plugins_.cend()) {
plugins_[plugin_name] = boost::move(lib);
plugins_[plugin_name] = std::move(lib);
}
}
//]
Expand Down

0 comments on commit 29a15f6

Please sign in to comment.