.TH "cereal::detail::PolymorphicCasters" 3 "Sat Oct 10 2026 08:08:15" "cereal" \" -*- nroff -*- .ad l .nh .SH NAME cereal::detail::PolymorphicCasters \- Holds registered mappings between base and derived types for casting\&. .SH SYNOPSIS .br .PP .PP \fR#include \fP .SS "Public Types" .in +1c .ti -1c .RI "using \fBDerivedCasterMap\fP = std::unordered_map>" .br .RI "Maps from a derived type index to a set of chainable casters\&. " .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static std::pair< bool, std::vector< \fBPolymorphicCaster\fP const * > const & > \fBlookup_if_exists\fP (std::type_index const &baseIndex, std::type_index const &derivedIndex)" .br .RI "Checks if the mapping object that can perform the upcast or downcast exists, and returns it if so\&. " .ti -1c .RI "template static std::vector< \fBPolymorphicCaster\fP const * > const & \fBlookup\fP (std::type_index const &baseIndex, std::type_index const &derivedIndex, F &&exceptionFunc)" .br .RI "Gets the mapping object that can perform the upcast or downcast\&. " .ti -1c .RI "template static const Derived * \fBdowncast\fP (const void *dptr, std::type_info const &baseInfo)" .br .RI "Performs a downcast to the derived type using a registered mapping\&. " .ti -1c .RI "template static void * \fBupcast\fP (Derived *const dptr, std::type_info const &baseInfo)" .br .RI "Performs an upcast to the registered base type using the given a derived type\&. " .ti -1c .RI "template static std::shared_ptr< void > \fBupcast\fP (std::shared_ptr< Derived > const &dptr, std::type_info const &baseInfo)" .br .RI "Upcasts for shared pointers\&. " .in -1c .SS "Public Attributes" .in +1c .ti -1c .RI "std::unordered_map< std::type_index, \fBDerivedCasterMap\fP > \fBmap\fP" .br .RI "Maps from base type index to a map from derived type index to caster\&. " .ti -1c .RI "std::multimap< std::type_index, std::type_index > \fBreverseMap\fP" .br .in -1c .SH "Detailed Description" .PP Holds registered mappings between base and derived types for casting\&. This will be allocated as a \fBStaticObject\fP and holds a map containing all registered mappings between base and derived types\&. .SH "Member Function Documentation" .PP .SS "template std::vector< \fBPolymorphicCaster\fP const * > const & cereal::detail::PolymorphicCasters::lookup (std::type_index const & baseIndex, std::type_index const & derivedIndex, F && exceptionFunc)\fR [inline]\fP, \fR [static]\fP" .PP Gets the mapping object that can perform the upcast or downcast\&. Uses the type index from the base and derived class to find the matching registered caster\&. If no matching caster exists, calls the exception function\&. .PP The returned \fBPolymorphicCaster\fP is capable of upcasting or downcasting between the two types\&. .SS "std::pair< bool, std::vector< \fBPolymorphicCaster\fP const * > const & > cereal::detail::PolymorphicCasters::lookup_if_exists (std::type_index const & baseIndex, std::type_index const & derivedIndex)\fR [inline]\fP, \fR [static]\fP" .PP Checks if the mapping object that can perform the upcast or downcast exists, and returns it if so\&. Uses the type index from the base and derived class to find the matching registered caster\&. If no matching caster exists, the bool in the pair will be false and the vector reference should not be used\&. .SS "template void * cereal::detail::PolymorphicCasters::upcast (Derived *const dptr, std::type_info const & baseInfo)\fR [inline]\fP, \fR [static]\fP" .PP Performs an upcast to the registered base type using the given a derived type\&. The return is untyped because the final casting to the base type must happen in the polymorphic serialization function, where the type is known at compile time .SH "Author" .PP Generated automatically by Doxygen for cereal from the source code\&.