do not put initialize in aliases

This commit is contained in:
Jean-Louis Leroy
2025-11-15 16:24:41 -05:00
parent 4d91aab7fd
commit b8da0a1088
4 changed files with 6 additions and 10 deletions

View File

@@ -41,7 +41,7 @@ int main() {
// end::unload[]
std::cout << "Before loading the shared library.\n";
initialize();
boost::openmethod::initialize();
std::cout << "cow meets wolf -> "
<< meet(*std::make_unique<Cow>(), *std::make_unique<Wolf>())
@@ -60,7 +60,7 @@ int main() {
boost::dll::shared_library lib(
boost::dll::program_location().parent_path() / LIBRARY_NAME,
boost::dll::load_mode::rtld_now);
initialize();
boost::openmethod::initialize();
std::cout << "cow meets wolf -> "
<< meet(*std::make_unique<Cow>(), *std::make_unique<Wolf>())
@@ -83,7 +83,7 @@ int main() {
std::cout << "\nAfter unloading the shared library.\n";
lib.unload();
initialize();
boost::openmethod::initialize();
std::cout << "cow meets wolf -> "
<< meet(*std::make_unique<Cow>(), *std::make_unique<Wolf>())

View File

@@ -37,7 +37,7 @@ auto main() -> int {
using namespace boost::openmethod::aliases;
std::cout << "Before loading the shared library.\n";
initialize();
boost::openmethod::initialize();
auto gracie = make_unique_virtual<Cow>();
auto willy = make_unique_virtual<Wolf>();
@@ -53,7 +53,7 @@ auto main() -> int {
boost::dll::program_location().parent_path() / LIBRARY_NAME,
boost::dll::load_mode::rtld_now);
initialize();
boost::openmethod::initialize();
std::cout << "cow meets wolf -> " << meet(*gracie, *willy) << "\n"; // run
std::cout << "wolf meets cow -> " << meet(*willy, *gracie) << "\n"; // hunt

View File

@@ -30,7 +30,7 @@ auto make_tiger() -> Animal*;
}
auto main() -> int {
initialize();
boost::openmethod::initialize();
std::unique_ptr<Animal> gracie(new Cow());
std::unique_ptr<Animal> willy(new Wolf());

View File

@@ -1675,10 +1675,6 @@ inline auto finalize(Options&&... opts) -> void {
Registry::finalize(std::forward<Options>(opts)...);
}
namespace aliases {
using boost::openmethod::initialize;
}
} // namespace boost::openmethod
#ifdef _MSC_VER