BOOST_OPENMETHOD_DEFAULT_REGISTRY
Default value for Registry.
Synopsis
Declared in <boost/openmethod/core.hpp>
#define BOOST_OPENMETHOD_DEFAULT_REGISTRY
Description
The name of the default registry.
BOOST_OPENMETHOD_DEFAULT_REGISTRY is the registry that a construct taking one as a template argument uses when neither the construct nor the class it is about names another: directly, as boost::openmethod::use_classes does, or as the registry a class has an affinity for when it declares none ‐ which is what boost::openmethod::method and boost::openmethod::virtual_ptr default to. See boost::openmethod::registry_affinity.
BOOST_OPENMETHOD_DEFAULT_REGISTRY can be defined by a program to change the default registry globally, before including <boost/openmethod/core.hpp> (or any header that includes it, like <boost/openmethod.hpp>). After that, changing its value has no effect, even on other macros.
To use a registry that the library provides, name it in the macro:
#define BOOST_OPENMETHOD_DEFAULT_REGISTRY boost::openmethod::indirect_registry
#include <boost/openmethod.hpp>
To use a registry of your own, declare the class before the include, and define it after:
struct my_registry;
#define BOOST_OPENMETHOD_DEFAULT_REGISTRY my_registry
#include <boost/openmethod.hpp>
// plus any policies/ and interop/ headers needed, in any order
struct my_registry
: boost::openmethod::default_registry::with<my_policy> {};
Only the declaration has to precede the include. Deferring the definition is what makes it possible to build the registry from the policies that <boost/openmethod.hpp> brings in ‐ and from policies of your own, written against them.
The registry must be complete before the first construct that instantiates it: a BOOST_OPENMETHOD* macro, boost::openmethod::use_classes, boost::openmethod::method, boost::openmethod::virtual_ptr, or BOOST_OPENMETHOD_IMPORT_REGISTRY and its companions.
|
The value must name a class, not a typedef or an alias template, and the declaration must use the same class‐key as the definition. Qualify the name ( |
|
Use this feature with caution, as it will cause ODR violations if different translation units define different default registries. |
See Also
Created with MrDocs