C/C++ API Reference
Loading...
Searching...
No Matches
Core interfaces

Overview

Generic allocator interfaces that can be injected into routines that need dynamic memory.

These include Allocator, as well as the Layout type that is passed to it and the managed smart pointer types, such as UniquePtr, that can be returned from it.

Classes

class  pw::SharedPtr< T >
 
class  pw::Allocator
 
class  pw::allocator::Layout
 
class  pw::allocator::Pool
 
class  pw::WeakPtr< T >
 
class  pw::UniquePtr< T >
 

Functions

bool pw::allocator::operator== (const Layout &lhs, const Layout &rhs)
 
bool pw::allocator::operator!= (const Layout &lhs, const Layout &rhs)
 
template<typename To , typename From >
constexpr SharedPtr< To > pw::static_pointer_cast (const SharedPtr< From > &p) noexcept
 
template<typename To , typename From >
constexpr SharedPtr< To > pw::const_pointer_cast (const SharedPtr< From > &p) noexcept
 
template<typename U , typename >
WeakPtr< T > & pw::WeakPtr< T >::operator= (const WeakPtr< U > &other) noexcept
 
template<typename U , typename >
WeakPtr< T > & pw::WeakPtr< T >::operator= (const SharedPtr< U > &other) noexcept
 
template<typename U , typename >
WeakPtr< T > & pw::WeakPtr< T >::operator= (WeakPtr< U > &&other) noexcept
 
void pw::WeakPtr< T >::reset () noexcept
 
SharedPtr< T > pw::WeakPtr< T >::Lock () const noexcept
 

Function Documentation

◆ const_pointer_cast()

template<typename To , typename From >
constexpr SharedPtr< To > pw::const_pointer_cast ( const SharedPtr< From > &  p)
constexprnoexcept

Creates a new SharedPtr by const casting the given shared pointer.

For an arbitrary type A, a shared pointer to A can be automatically converted to one of type const A. This function can perform the reverse operation.

pw::SharedPtr<const A> a1 = allocator.MakeShared<const A>();
pw::SharedPtr<A> a2 = const_pointer_cast<A>(a1);
Definition: shared_ptr.h:76

◆ Lock()

template<typename T >
SharedPtr< T > pw::WeakPtr< T >::Lock
noexcept

Creates a new SharedPtr to the associated object, or an empty SharedPtr if this object is empty.

◆ reset()

template<typename T >
void pw::WeakPtr< T >::reset
noexcept

Resets this object to an empty state.

If this is the last shared or weak pointer associated with the control block, it is deallocated.

◆ static_pointer_cast()

template<typename To , typename From >
constexpr SharedPtr< To > pw::static_pointer_cast ( const SharedPtr< From > &  p)
constexprnoexcept

Creates a new SharedPtr by static casting the given shared pointer.

If an arbitrary type A derives from another type B, a shared pointer to A can be automatically upcast to one of type B. This function can perform the reverse operation and allows specifying only the element type.

pw::SharedPtr<A> a1 = allocator.MakeShared<A>();
pw::SharedPtr<A> a2 = static_pointer_cast<A>(b);