.TH "polymorphic_impl.hpp" 3 "Sat Oct 10 2026 08:08:15" "cereal" \" -*- nroff -*- .ad l .nh .SH NAME polymorphic_impl.hpp \- Internal polymorphism support\&. .SH SYNOPSIS .br .PP \fR#include 'cereal/details/polymorphic_impl_fwd\&.hpp'\fP .br \fR#include 'cereal/details/static_object\&.hpp'\fP .br \fR#include 'cereal/types/memory\&.hpp'\fP .br \fR#include 'cereal/types/string\&.hpp'\fP .br \fR#include \fP .br \fR#include \fP .br \fR#include \fP .br \fR#include \fP .br \fR#include \fP .br \fR#include \fP .br .SS "Classes" .in +1c .ti -1c .RI "struct \fBcereal::detail::PolymorphicCaster\fP" .br .RI "Base type for polymorphic void casting\&. " .ti -1c .RI "struct \fBcereal::detail::PolymorphicCasters\fP" .br .RI "Holds registered mappings between base and derived types for casting\&. " .ti -1c .RI "struct \fBcereal::detail::PolymorphicVirtualCaster< Base, Derived >\fP" .br .RI "Strongly typed derivation of \fBPolymorphicCaster\fP\&. " .ti -1c .RI "struct \fBcereal::detail::RegisterPolymorphicCaster< Base, Derived >\fP" .br .RI "Registers a polymorphic casting relation between a Base and Derived type\&. " .ti -1c .RI "struct \fBcereal::detail::binding_name< T >\fP" .br .RI "Binds a compile time type with a user defined string\&. " .ti -1c .RI "struct \fBcereal::detail::OutputBindingMap< Archive >\fP" .br .RI "A structure holding a map from type_indices to output serializer functions\&. " .ti -1c .RI "struct \fBcereal::detail::OutputBindingMap< Archive >::Serializers\fP" .br .RI "Struct containing the serializer functions for all pointer types\&. " .ti -1c .RI "struct \fBcereal::detail::EmptyDeleter< T >\fP" .br .RI "An empty noop deleter\&. " .ti -1c .RI "struct \fBcereal::detail::InputBindingMap< Archive >\fP" .br .RI "A structure holding a map from type name strings to input serializer functions\&. " .ti -1c .RI "struct \fBcereal::detail::InputBindingMap< Archive >::Serializers\fP" .br .RI "Struct containing the serializer functions for all pointer types\&. " .ti -1c .RI "struct \fBcereal::detail::InputBindingCreator< Archive, T >\fP" .br .RI "Creates a binding (map entry) between an input archive type and a polymorphic type\&. " .ti -1c .RI "struct \fBcereal::detail::OutputBindingCreator< Archive, T >\fP" .br .RI "Creates a binding (map entry) between an output archive type and a polymorphic type\&. " .ti -1c .RI "class \fBcereal::detail::OutputBindingCreator< Archive, T >::PolymorphicSharedPointerWrapper\fP" .br .RI "Holds a properly typed shared_ptr to the polymorphic type\&. " .ti -1c .RI "struct \fBcereal::detail::adl_tag\fP" .br .ti -1c .RI "struct \fBcereal::detail::create_bindings< Archive, T >\fP" .br .RI "Causes the static object bindings between an archive type and a serializable type T\&. " .ti -1c .RI "struct \fBcereal::detail::instantiate_function<>\fP" .br .RI "When specialized, causes the compiler to instantiate its parameter\&. " .ti -1c .RI "struct \fBcereal::detail::polymorphic_serialization_support< Archive, T >\fP" .br .ti -1c .RI "struct \fBcereal::detail::bind_to_archives< T, Tag >\fP" .br .RI "Begins the binding process of a type to all registered archives\&. " .in -1c .SS "Macros" .in +1c .ti -1c .RI "#define \fBCEREAL_BIND_TO_ARCHIVES_UNUSED_FUNCTION\fP static void unused() { (void)b; }" .br .RI "Helper macro to omit unused warning\&. " .ti -1c .RI "#define \fBCEREAL_BIND_TO_ARCHIVES\fP(\&.\&.\&.)" .br .RI "Binds a polymorhic type to all registered archives\&. " .ti -1c .RI "#define \fBUNREGISTERED_POLYMORPHIC_CAST_EXCEPTION\fP(LoadSave)" .br .RI "Error message used for unregistered polymorphic casts\&. " .ti -1c .RI "#define \fBCEREAL_EMPLACE_MAP\fP(map, key, value)" .br .in -1c .SS "Functions" .in +1c .ti -1c .RI "template void \fBcereal::detail::instantiate_polymorphic_binding\fP (T *, int, BindingTag, \fBadl_tag\fP)" .br .RI "Base case overload for instantiation\&. " .in -1c .SH "Detailed Description" .PP Internal polymorphism support\&. .SH "Macro Definition Documentation" .PP .SS "#define CEREAL_BIND_TO_ARCHIVES( \&.\&.\&.)" \fBValue:\fP .nf namespace cereal { \\ namespace detail { \\ template<> \\ struct init_binding<__VA_ARGS__> { \\ static bind_to_archives<__VA_ARGS__> const& b; \\ CEREAL_BIND_TO_ARCHIVES_UNUSED_FUNCTION \\ }; \\ bind_to_archives<__VA_ARGS__> const & init_binding<__VA_ARGS__>::b = \\ ::cereal::detail::StaticObject< \\ bind_to_archives<__VA_ARGS__> \\ >::getInstance()\&.bind(); \\ }} .PP .fi .PP Binds a polymorhic type to all registered archives\&. This binds a polymorphic type to all compatible registered archives that have been registered with CEREAL_REGISTER_ARCHIVE\&. This must be called after all archives are registered (usually after the archives themselves have been included)\&. .SS "#define CEREAL_EMPLACE_MAP( map, key, value)" \fBValue:\fP .nf map\&.emplace( key, value ); .PP .fi .SS "#define UNREGISTERED_POLYMORPHIC_CAST_EXCEPTION( LoadSave)" \fBValue:\fP .nf throw cereal::Exception("Trying to " #LoadSave " a registered polymorphic type with an unregistered polymorphic cast\&.\\n" \\ "Could not find a path to a base class (" + util::demangle(baseInfo\&.name()) + ") for type: " + ::cereal::util::demangledName() + "\\n" \\ "Make sure you either serialize the base class at some point via cereal::base_class or cereal::virtual_base_class\&.\\n" \\ "Alternatively, manually register the association with CEREAL_REGISTER_POLYMORPHIC_RELATION\&."); .PP .fi .PP Error message used for unregistered polymorphic casts\&. .SH "Function Documentation" .PP .SS "template void cereal::detail::instantiate_polymorphic_binding (T * , int , BindingTag , \fBadl_tag\fP )" .PP Base case overload for instantiation\&. This will end up always being the best overload due to the second parameter always being passed as an int\&. All other overloads will accept pointers to archive types and have lower precedence than int\&. .PP Since the compiler needs to check all possible overloads, the other overloads created via CEREAL_REGISTER_ARCHIVE, which will have lower precedence due to requring a conversion from int to (Archive*), will cause their return types to be instantiated through the static object mechanisms even though they are never called\&. .PP See the documentation for the other functions to try and understand this .SH "Author" .PP Generated automatically by Doxygen for cereal from the source code\&.