HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_UniquePtr.h File Reference
#include <stddef.h>
#include <memory>
#include <type_traits>
#include <utility>
+ Include dependency graph for UT_UniquePtr.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  UT::DefaultClearer< T >
 
struct  UT::DefaultClearer< UT_UniquePtr< T > >
 

Namespaces

 UT
 

Typedefs

template<class T , class Deleter = std::default_delete<T>>
using UT_UniquePtr = std::unique_ptr< T, Deleter >
 A smart pointer for unique ownership of dynamically allocated objects. More...
 

Functions

template<class T , class... REST>
std::enable_if< !std::is_array
< T >::value, UT_UniquePtr< T >
>::type 
UTmakeUnique (REST &&...args)
 
template<class T >
std::enable_if< std::is_array
< T >::value &&std::extent< T >
::value==0, UT_UniquePtr< T >
>::type 
UTmakeUnique (size_t len)
 
template<class T , class... REST>
std::enable_if< std::extent< T >
::value!=0, void >::type 
UTmakeUnique (REST &&...)=delete
 Construction of arrays of known bound is disallowed. Just do it directly! More...
 

Typedef Documentation

template<class T , class Deleter = std::default_delete<T>>
using UT_UniquePtr = std::unique_ptr<T, Deleter>

A smart pointer for unique ownership of dynamically allocated objects.

UT_UniquePtr mimics a built-in pointer except that it guarantees deletion of the object pointed to, either upon destruction or via an explicit reset(). UT_UniquePtr is a simple solution for simple needs; use UT_SharedPtr/UT_IntrusivePtr if your needs are more complex.

Definition at line 33 of file UT_UniquePtr.h.

Function Documentation

template<class T , class... REST>
std::enable_if< !std::is_array<T>::value, UT_UniquePtr<T>>::type UTmakeUnique ( REST &&...  args)
inline

Constructs an object of type T and wraps it in an UT_UniquePtr. The args are passed to the constructor of T.

Definition at line 46 of file UT_UniquePtr.h.

template<class T >
std::enable_if< std::is_array<T>::value && std::extent<T>::value == 0, UT_UniquePtr<T>>::type UTmakeUnique ( size_t  len)
inline

Constructs an 1D array of type T with len elements and wraps it in an UT_UniquePtr.

Definition at line 58 of file UT_UniquePtr.h.

template<class T , class... REST>
std::enable_if<std::extent<T>::value != 0, void>::type UTmakeUnique ( REST &&  ...)
delete

Construction of arrays of known bound is disallowed. Just do it directly!