boost::openmethod::policies::std_rtti::fn::type_index
Returns a key that uniquely identifies a class.
Synopsis
Declared in <boost/openmethod/policies/std_rtti.hpp>
static
std::string_view
type_index(type_id type);
Description
C++ does not guarantee that there is a single instance of std::type_info per type: a class used by several modules of a program typically has one per module. type_index maps a type_id to a key that compares equal for all the type_id`s of one class, which is what `initialize uses to group the registrations coming from different modules.
The key is the name, not the address and not a std::type_index. std::type_index would delegate to std::type_info::operator==, and that is only as good as the platform's RTTI uniqueness: libstdc++ falls back to comparing names, but libc++ on Darwin compares uniquely‐named RTTI by address. There, two modules' type_info objects for the same type compare unequal unless the symbol happens to be exported and coalesced by dyld ‐ which, for a template like method<Id, Signature, Registry>, requires every template argument to have default visibility as well. Under ‐fvisibility=hidden that is not the case, the copies are not grouped, each module's method keeps its own overrider list, and calls report no_overrider. Comparing names sidesteps the platform's uniqueness rules entirely.
Parameters
Name |
Description |
type |
A |
Created with MrDocs