Skip to content

Commit 243a333

Browse files
committed
registry.hpp -> preamble.hpp
1 parent e140c97 commit 243a333

File tree

2 files changed

+38
-27
lines changed

2 files changed

+38
-27
lines changed

doc/modules/ROOT/pages/BOOST_OPENMETHOD_DEFAULT_REGISTRY.adoc

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,20 @@ The name of the default registry.
1717
`BOOST_OPENMETHOD_DEFAULT_REGISTRY` is the default value for the `Registry`
1818
template parameter of `method`, `use_classes`, and other constructs defined in
1919
`<boost/openmethod/core.hpp>`. If it is not defined,
20-
link:reference/boost/openmethod/default_registry.html[`default_registry`] is used.
20+
link:reference/boost/openmethod/default_registry.html[`default_registry`] is
21+
used.
2122

2223
`BOOST_OPENMETHOD_DEFAULT_REGISTRY` can be defined by a program to change the
23-
default REGISTRY globally. Once `<boost/openmethod/core.hpp>` has been included,
24-
redefining the symbol has no effect. To override the default REGISTRY, proceed as
25-
follows:
24+
default registry globally. Once `<boost/openmethod/core.hpp>` has been included,
25+
redefining the symbol has no effect. To override the default registry, proceed
26+
as follows:
27+
28+
1. Include `<boost/openmethod/preamble.hpp>`, and
29+
`<boost/openmethod/default_registry.hpp>` or any of the
30+
`<boost/openmethod/policies/*.hpp>` as needed.
31+
32+
2. Set `BOOST_OPENMETHOD_DEFAULT_REGISTRY`.
2633

27-
1. Include headers under `boost/openmethod/policies/` as needed.
28-
2. Create a REGISTRY class, and set `BOOST_OPENMETHOD_DEFAULT_REGISTRY`.
2934
3. Include `<boost/openmethod/core.hpp>`.
3035

3136
Use this feature with caution, as it can easily lead to ODR violations if

include/boost/openmethod/core.hpp

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -537,23 +537,25 @@ inline vptr_type null_vptr = nullptr;
537537

538538
} // namespace detail
539539

540-
//! Create a `virtual_ptr` for an object of an exact known type
541-
//!
542-
//! `final_virtual_ptr` creates a `virtual_ptr` to an object, setting its
543-
//! v-table pointer according to the declared type of its argument. It assumes
544-
//! that the static and dynamic types are the same. The v-table pointer is
545-
//! initialized from the `Policy::static_vptr` for the class, which needs
546-
//! not be polymorphic.
547-
//!
548-
//! @par Errors If the registry has runtime checks enabled, and the argument is
549-
//! a class type that is polymorphic according to the registry's `rtti` policy,
550-
//! a check is performed to verify that the static and dynamic types are indeed
551-
//! the same. If they are not, and if the registry contains an @ref
552-
//! error_handler policy, its
553-
//! @ref error function is called with a @ref final_error value, then the
554-
//! program is terminated with @ref abort.
555-
//!
556-
//! @tparam Registry The registry in which the class is registered.
540+
//! Creates a `virtual_ptr` for an object of a known dynamic type.
541+
//!
542+
//! Creates a @ref virtual_ptr to an object, setting its v-table pointer
543+
//! according to the declared type of its argument. Assumes that the static and
544+
//! dynamic types are the same. Sets the v-table pointer to the
545+
//! @ref registry::static_vptr for the class.
546+
//!
547+
//! `Class` is _not_ required to be polymorphic.
548+
//!
549+
//! If runtime checks are enabled, and the argument is polymorphic, checks if
550+
//! the static and dynamic types are the same. If not, calls the error handler
551+
//! with a @ref final_error value, then terminates the program with @ref abort.
552+
//!
553+
//! @par Errors
554+
//!
555+
//! @li @ref final_error The static and dynamic types of the object are
556+
//! different.
557+
//!
558+
//! @tparam Registry A @ref registry.
557559
//! @tparam Arg The type of the argument.
558560
//! @param obj A reference to an object.
559561
//! @return A `virtual_ptr<Class, Registry>` pointing to `obj`.
@@ -590,6 +592,12 @@ inline auto final_virtual_ptr(Arg&& obj) {
590592
Registry::template static_vptr<Class>));
591593
}
592594

595+
//! Create a `virtual_ptr` for an object of a known dynamic type.
596+
//!
597+
//! This is an overload of `final_virtual_ptr` that uses the default
598+
//! registry as the `Registry` template parameter.
599+
//!
600+
//! @see @ref final_virtual_ptr
593601
template<class Arg>
594602
inline auto final_virtual_ptr(Arg&& obj) {
595603
return final_virtual_ptr<BOOST_OPENMETHOD_DEFAULT_REGISTRY, Arg>(
@@ -611,16 +619,14 @@ inline auto final_virtual_ptr(Arg&& obj) {
611619
//! "plain" `virtual_ptr` can be constructed from a smart `virtual_ptr`, but not
612620
//! the other way around.
613621
//!
614-
//! TODO: link out from mrdocs to macro documentation
615-
//! The default value for `Registry` can be customized by defining the <a href="openmethod/BOOST_OPENMETHOD_DEFAULT_REGISTRY.html">BOOST_OPENMETHOD_DEFAULT_REGISTRY</a>
622+
//! The default value for `Registry` can be customized by defining the
623+
//! [BOOST_OPENMETHOD_DEFAULT_REGISTRY](../BOOST_OPENMETHOD_DEFAULT_REGISTRY.html)
616624
//! preprocessor symbol.
617625
//!
618626
//! The default value for `Registry` can be customized by defining the
619627
//! xref:BOOST_OPENMETHOD_DEFAULT_REGISTRY.adoc[`BOOST_OPENMETHOD_DEFAULT_REGISTRY`]
620628
//! preprocessor symbol.
621629
//!
622-
//! @par Examples
623-
//!
624630
//! @par Requirements
625631
//!
626632
//! @li @ref virtual_traits must be specialized for `Class&`.

0 commit comments

Comments
 (0)