cereal::detail::PolymorphicCaster(3) Library Functions Manual cereal::detail::PolymorphicCaster(3)

# [NAME](#NAME)

cereal::detail::PolymorphicCaster - Base type for polymorphic void casting.

# [SYNOPSIS](#SYNOPSIS)

#include &lt;/home/build/include/cereal/details/polymorphic\_impl.hpp&gt;

Inherited by **cereal::detail::PolymorphicVirtualCaster&lt; Base, Derived &gt;**.

## [Public Member Functions](#Public_Member_Functions)

**PolymorphicCaster** (const PolymorphicCaster &)=default  
PolymorphicCaster & **operator=** (const PolymorphicCaster &)=default  
**PolymorphicCaster** (PolymorphicCaster &&) **CEREAL\_NOEXCEPT**  
PolymorphicCaster & **operator=** (PolymorphicCaster &&) **CEREAL\_NOEXCEPT**  
virtual void const * **downcast** (void const \*const ptr) const =0  
Downcasts to the proper derived type. virtual void * **upcast** (void \*const ptr) const =0  
Upcast to proper base type. virtual std::shared\_ptr&lt; void &gt; **upcast** (std::shared\_ptr&lt; void &gt; const &ptr) const =0  
Upcast to proper base type, shared\_ptr version.

# [Detailed Description](#Detailed_Description)

Base type for polymorphic void casting.

Contains functions for casting between registered base and derived types.

This is necessary so that cereal can properly cast between polymorphic types even though void pointers are used, which normally have no type information. Runtime type information is used instead to index a compile-time made mapping that can perform the proper cast. In the case of multiple levels of inheritance, cereal will attempt to find the shortest path by using registered relationships to perform the cast.

This class will be allocated as a **StaticObject** and only referenced by pointer, allowing a templated derived version of it to define strongly typed functions that cast between registered base and derived types.

# [Member Function Documentation](#Member_Function_Documentation)

## [virtual void const * cereal::detail::PolymorphicCaster::downcast (void const \*const ptr) const \[pure virtual\]](#virtual_void_const__*_cereal::detail::PolymorphicCaster::downcast_%28void_const_*const_ptr%29_const)

Downcasts to the proper derived type.

Implemented in **cereal::detail::PolymorphicVirtualCaster&lt; Base, Derived &gt;**.

## [virtual std::shared\_ptr&lt; void &gt; cereal::detail::PolymorphicCaster::upcast (std::shared\_ptr&lt; void &gt; const & ptr) const \[pure virtual\]](#virtual_std::shared_ptr__void___cereal::detail::PolymorphicCaster::upcast_%28std::shared_ptr__void___const_&_ptr%29_const)

Upcast to proper base type, shared\_ptr version.

Implemented in **cereal::detail::PolymorphicVirtualCaster&lt; Base, Derived &gt;**.

## [virtual void * cereal::detail::PolymorphicCaster::upcast (void \*const ptr) const \[pure virtual\]](#virtual_void_*_cereal::detail::PolymorphicCaster::upcast_%28void_*const_ptr%29_const)

Upcast to proper base type.

Implemented in **cereal::detail::PolymorphicVirtualCaster&lt; Base, Derived &gt;**.

# [Author](#Author)

Generated automatically by Doxygen for cereal from the source code.

Sat Aug 29 2026 00:42:30 cereal

---

Document: cereal_detail_PolymorphicCaster(3) from cereal 1.3.2-r5 (Chainguard OS)
Source: https://github.com/USCiLab/cereal
