diff --git a/doc/modules/ROOT/examples/shared_libs/dynamic_main.cpp b/doc/modules/ROOT/examples/shared_libs/dynamic_main.cpp index c383593..b74ea6d 100644 --- a/doc/modules/ROOT/examples/shared_libs/dynamic_main.cpp +++ b/doc/modules/ROOT/examples/shared_libs/dynamic_main.cpp @@ -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(), *std::make_unique()) @@ -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(), *std::make_unique()) @@ -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(), *std::make_unique()) diff --git a/doc/modules/ROOT/examples/shared_libs/indirect_main.cpp b/doc/modules/ROOT/examples/shared_libs/indirect_main.cpp index a968f46..555435e 100644 --- a/doc/modules/ROOT/examples/shared_libs/indirect_main.cpp +++ b/doc/modules/ROOT/examples/shared_libs/indirect_main.cpp @@ -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(); auto willy = make_unique_virtual(); @@ -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 diff --git a/doc/modules/ROOT/examples/shared_libs/static_main.cpp b/doc/modules/ROOT/examples/shared_libs/static_main.cpp index 3f2ae6a..a285a2a 100644 --- a/doc/modules/ROOT/examples/shared_libs/static_main.cpp +++ b/doc/modules/ROOT/examples/shared_libs/static_main.cpp @@ -30,7 +30,7 @@ auto make_tiger() -> Animal*; } auto main() -> int { - initialize(); + boost::openmethod::initialize(); std::unique_ptr gracie(new Cow()); std::unique_ptr willy(new Wolf()); diff --git a/doc/mrdocs.yml b/doc/mrdocs.yml index ea838b4..d1e1268 100644 --- a/doc/mrdocs.yml +++ b/doc/mrdocs.yml @@ -22,6 +22,8 @@ inaccessible-bases: never # implementation-defined: # - 'boost::openmethod::detail::**' exclude-symbols: + - 'boost::openmethod::registry::initialize' + - 'boost::openmethod::registry::finalize' - 'boost::openmethod::boost_openmethod_bases' - 'boost::openmethod::boost_openmethod_registry' diff --git a/include/boost/openmethod/initialize.hpp b/include/boost/openmethod/initialize.hpp index 7f829d8..17098d1 100644 --- a/include/boost/openmethod/initialize.hpp +++ b/include/boost/openmethod/initialize.hpp @@ -1657,13 +1657,22 @@ auto registry::finalize(Options... opts) -> void { initialized = false; } -//! Finalize the default registry -inline auto finalize() -> void { - BOOST_OPENMETHOD_DEFAULT_REGISTRY::finalize(); -} - -namespace aliases { -using boost::openmethod::initialize; +//! Release resources held by registry. +//! +//! `finalize` may be called to release any resources allocated by +//! @ref registry::initialize. +//! +//! @note +//! A translation unit that contains a call to `finalize` must include the +//! `` header. +//! +//! @tparam Registry The registry to finalize. +//! @tparam Options... Zero or more option types, deduced from the function +//! arguments. +//! @param options Zero or more option objects. +template +inline auto finalize(Options&&... opts) -> void { + Registry::finalize(std::forward(opts)...); } } // namespace boost::openmethod diff --git a/include/boost/openmethod/preamble.hpp b/include/boost/openmethod/preamble.hpp index edda369..9f68286 100644 --- a/include/boost/openmethod/preamble.hpp +++ b/include/boost/openmethod/preamble.hpp @@ -946,16 +946,6 @@ class registry : detail::registry_base { //! @li @ref not_initialized: The registry is not initialized. static void require_initialized(); - //! Releases the resources held by the registry. - //! - //! `finalize` may be called to release any resources allocated by - //! @ref registry::initialize. - //! - //! @note - //! A translation unit that contains a call to `finalize` must include the - //! `` header. - //! - //! @tparam Options A registry. template static void finalize(Options... opts); diff --git a/test/test_dispatch.cpp b/test/test_dispatch.cpp index 780367f..5cd3639 100644 --- a/test/test_dispatch.cpp +++ b/test/test_dispatch.cpp @@ -339,7 +339,7 @@ BOOST_AUTO_TEST_CASE(simple) { if constexpr (std::is_same_v) { BOOST_TEST( !detail::vptr_vector_vptrs.empty()); - test_registry::finalize(); + finalize(); static_assert(detail::has_finalize_aux< void, test_registry::policy, std::tuple<>>::value);