cptr::destroy

Destroy and free an object created by make(), as delete does; null is a no-op. A pointer to const works, as for delete.

Synopsis

Declared in <cptr/ptr.hpp>

template<
    class T,
    class Cage,
    bool Strict>
void
destroy(basic_ptr<T, Cage, Strict> p) noexcept;

Description

Destroying through a pointer to a base class needs a virtual destructor, as delete does; the memory freed is then the whole object's, even with multiple inheritance.

Parameters

NameDescription
pA nullable pointer to a T inside Cage, stored in 4 bytes. Use it as ptr<T> or strict_ptr<T>, declared below.