libSCALE  0.2.0
A modern C++ CUDA API
Smart Pointer Utilities

Utilities for dealing with smart pointers. More...

Modules

 Deleters
 Smart pointer deleter functions, suitable for use with STL smart pointers.
 

Typedefs

template<typename T , typename Q = T>
using sp::UniquePtr = std::unique_ptr< T, std::function< void(Q *)> >
 Handy type alias for std::unique_ptrs that have simple custom deleters. More...
 

Functions

template<typename T , typename U , typename Deleter >
std::unique_ptr< T, Deleter > sp::static_pointer_cast (std::unique_ptr< U, Deleter > &r) noexcept
 Perform a static_cast operation on an std::unique_ptr. More...
 
template<typename T , typename U , typename Deleter >
std::unique_ptr< T, Deleter > sp::dynamic_pointer_cast (std::unique_ptr< U, Deleter > &r) noexcept
 Like static_pointer_cast, but performs a dynamic_cast() More...
 
template<typename T , typename U , typename Deleter >
std::unique_ptr< T, Deleter > sp::const_pointer_cast (std::unique_ptr< U, Deleter > &r) noexcept
 Like static_pointer_cast, but performs a const_cast() More...
 
template<typename T , typename U , typename Deleter >
std::unique_ptr< T, Deleter > sp::reinterpret_pointer_cast (std::unique_ptr< U, Deleter > &r) noexcept
 Like static_pointer_cast, but performs a reinterpret_cast() More...
 

Detailed Description

Utilities for dealing with smart pointers.

Typedef Documentation

◆ UniquePtr

template<typename T , typename Q = T>
using sp::UniquePtr = typedef std::unique_ptr<T, std::function<void(Q*)> >

Handy type alias for std::unique_ptrs that have simple custom deleters.

Function Documentation

◆ const_pointer_cast()

template<typename T , typename U , typename Deleter >
std::unique_ptr< T, Deleter > sp::const_pointer_cast ( std::unique_ptr< U, Deleter > &  r)
noexcept

Like static_pointer_cast, but performs a const_cast()

◆ dynamic_pointer_cast()

template<typename T , typename U , typename Deleter >
std::unique_ptr< T, Deleter > sp::dynamic_pointer_cast ( std::unique_ptr< U, Deleter > &  r)
noexcept

Like static_pointer_cast, but performs a dynamic_cast()

◆ reinterpret_pointer_cast()

template<typename T , typename U , typename Deleter >
std::unique_ptr< T, Deleter > sp::reinterpret_pointer_cast ( std::unique_ptr< U, Deleter > &  r)
noexcept

Like static_pointer_cast, but performs a reinterpret_cast()

◆ static_pointer_cast()

template<typename T , typename U , typename Deleter >
std::unique_ptr< T, Deleter > sp::static_pointer_cast ( std::unique_ptr< U, Deleter > &  r)
noexcept

Perform a static_cast operation on an std::unique_ptr.

Returns a new unique_ptr which owns the buffer originally owned by r, but cast to the new type. This operation destroys r. Future calls to r.get() will return nullptr.