mirror of
https://github.com/boostorg/openmethod.git
synced 2026-01-19 04:22:12 +00:00
make initialize and finalize symmetric
This commit is contained in:
@@ -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'
|
||||
|
||||
|
||||
@@ -1657,9 +1657,22 @@ auto registry<Policies...>::finalize(Options... opts) -> void {
|
||||
initialized = false;
|
||||
}
|
||||
|
||||
//! Finalize the default registry
|
||||
inline auto finalize() -> void {
|
||||
BOOST_OPENMETHOD_DEFAULT_REGISTRY::finalize();
|
||||
//! 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
|
||||
//! `<boost/openmethod/initialize.hpp>` 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<class Registry = BOOST_OPENMETHOD_DEFAULT_REGISTRY, class... Options>
|
||||
inline auto finalize(Options&&... opts) -> void {
|
||||
Registry::finalize(std::forward<Options>(opts)...);
|
||||
}
|
||||
|
||||
namespace aliases {
|
||||
|
||||
@@ -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
|
||||
//! `<boost/openmethod/initialize.hpp>` header.
|
||||
//!
|
||||
//! @tparam Options A registry.
|
||||
template<class... Options>
|
||||
static void finalize(Options... opts);
|
||||
|
||||
|
||||
@@ -339,7 +339,7 @@ BOOST_AUTO_TEST_CASE(simple) {
|
||||
if constexpr (std::is_same_v<test_registry::vptr, policies::vptr_vector>) {
|
||||
BOOST_TEST(
|
||||
!detail::vptr_vector_vptrs<test_registry::registry_type>.empty());
|
||||
test_registry::finalize();
|
||||
finalize<test_registry>();
|
||||
static_assert(detail::has_finalize_aux<
|
||||
void, test_registry::policy<policies::vptr>,
|
||||
std::tuple<>>::value);
|
||||
|
||||
Reference in New Issue
Block a user