cereal::detail::OutputBindingCreator&lt; Archive, T &gt;::PolymorphicSharedPointerWrapper(3) Library Functions Manual cereal::detail::OutputBindingCreator&lt; Archive, T &gt;::PolymorphicSharedPointerWrapper(3)

# [NAME](#NAME)

cereal::detail::OutputBindingCreator&lt; Archive, T &gt;::PolymorphicSharedPointerWrapper - Holds a properly typed shared\_ptr to the polymorphic type.

# [SYNOPSIS](#SYNOPSIS)

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

## [Public Member Functions](#Public_Member_Functions)

**PolymorphicSharedPointerWrapper** (T const \*dptr)  
std::shared\_ptr&lt; T const &gt; const & **operator()** () const  
Get the wrapped shared\_ptr \*/.

# [Detailed Description](#Detailed_Description)

## [template&lt;class Archive, class T&gt;](#template_class_Archive,_class_T_)

class cereal::detail::OutputBindingCreator&lt; Archive, T &gt;::PolymorphicSharedPointerWrapper"Holds a properly typed shared\_ptr to the polymorphic type.

# [Constructor & Destructor Documentation](#Constructor_&_Destructor_Documentation)

## [template&lt;class Archive, class T&gt; **cereal::detail::OutputBindingCreator**&lt; Archive, T &gt;::PolymorphicSharedPointerWrapper::PolymorphicSharedPointerWrapper (T const * dptr) \[inline\]](#template_class_Archive,_class_T__)

Wrap a raw polymorphic pointer in a shared\_ptr to its true type

The wrapped pointer will not be responsible for ownership of the held pointer so it will not attempt to destroy it; instead the refcount of the wrapped pointer will be tied to a fake 'ownership pointer' that will do nothing when it ultimately goes out of scope.

The main reason for doing this, other than not to destroy the true object with our wrapper pointer, is to avoid meddling with the internal reference count in a polymorphic type that inherits from std::enable\_shared\_from\_this.

**Parameters**

*dptr* A void pointer to the contents of the shared\_ptr to serialize

# [Author](#Author)

Generated automatically by Doxygen for cereal from the source code.

Sat Oct 10 2026 08:08:15 cereal

---

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