Skip to content

Commit 6060f4e

Browse files
committed
make initialize and finalize symmetric
1 parent 83bc8d2 commit 6060f4e

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

doc/mrdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ inaccessible-bases: never
2222
# implementation-defined:
2323
# - 'boost::openmethod::detail::**'
2424
exclude-symbols:
25+
- 'boost::openmethod::registry::initialize'
26+
- 'boost::openmethod::registry::finalize'
2527
- 'boost::openmethod::boost_openmethod_bases'
2628
- 'boost::openmethod::boost_openmethod_registry'
2729

include/boost/openmethod/initialize.hpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,9 +1657,22 @@ auto registry<Policies...>::finalize(Options... opts) -> void {
16571657
initialized = false;
16581658
}
16591659

1660-
//! Finalize the default registry
1661-
inline auto finalize() -> void {
1662-
BOOST_OPENMETHOD_DEFAULT_REGISTRY::finalize();
1660+
//! Release resources held by registry.
1661+
//!
1662+
//! `finalize` may be called to release any resources allocated by
1663+
//! @ref registry::initialize.
1664+
//!
1665+
//! @note
1666+
//! A translation unit that contains a call to `finalize` must include the
1667+
//! `<boost/openmethod/initialize.hpp>` header.
1668+
//!
1669+
//! @tparam Registry The registry to finalize.
1670+
//! @tparam Options... Zero or more option types, deduced from the function
1671+
//! arguments.
1672+
//! @param options Zero or more option objects.
1673+
template<class Registry = BOOST_OPENMETHOD_DEFAULT_REGISTRY, class... Options>
1674+
inline auto finalize(Options&&... opts) -> void {
1675+
Registry::finalize(std::forward<Options>(opts)...);
16631676
}
16641677

16651678
namespace aliases {

include/boost/openmethod/preamble.hpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -946,16 +946,6 @@ class registry : detail::registry_base {
946946
//! @li @ref not_initialized: The registry is not initialized.
947947
static void require_initialized();
948948

949-
//! Releases the resources held by the registry.
950-
//!
951-
//! `finalize` may be called to release any resources allocated by
952-
//! @ref registry::initialize.
953-
//!
954-
//! @note
955-
//! A translation unit that contains a call to `finalize` must include the
956-
//! `<boost/openmethod/initialize.hpp>` header.
957-
//!
958-
//! @tparam Options A registry.
959949
template<class... Options>
960950
static void finalize(Options... opts);
961951

test/test_dispatch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ BOOST_AUTO_TEST_CASE(simple) {
339339
if constexpr (std::is_same_v<test_registry::vptr, policies::vptr_vector>) {
340340
BOOST_TEST(
341341
!detail::vptr_vector_vptrs<test_registry::registry_type>.empty());
342-
test_registry::finalize();
342+
finalize<test_registry>();
343343
static_assert(detail::has_finalize_aux<
344344
void, test_registry::policy<policies::vptr>,
345345
std::tuple<>>::value);

0 commit comments

Comments
 (0)