boost::openmethod::policies::named_static_rtti
Implementation of the rtti policy that identifies classes by name.
Synopsis
Declared in <boost/openmethod/policies/named_static_rtti.hpp>
struct named_static_rtti
: rtti
Description
named_static_rtti is a static_rtti that works across modules. It categorizes all types as non‐polymorphic, and its type ids are addresses that differ from one module to the next, like those of static_rtti. In addition, type_index maps them to the name of the class, as the compiler prints it, so the registry merges the copies of a class coming from different modules.
All the modules must be built with the same compiler, because the names must be spelled the same way. Dispatch does not use names at all. They are read before main, once per class in each module, as the class registers itself, and compared once, by initialize.
A class that has internal linkage, or none, is not shared: it is identified by its type_id, as with static_rtti. This covers the classes defined in an anonymous namespace, local classes, lambdas, unnamed classes, and the templates instantiated with any of these. With C++26 reflection, the policy asks the compiler which classes they are. Otherwise, it recognizes them from the marks that the compiler leaves in their names.
|
Clang and MSVC leave no mark in the name of a local class. Clang prints it unqualified, and MSVC prints it as if the function were a namespace ( |
See Also
Created with MrDocs