SPH
Classes | Namespaces | Functions
AutoPtr.h File Reference

Simplified implementation of std::unique_ptr, using only default deleter. More...

#include "objects/wrappers/AlignedStorage.h"
#include "objects/wrappers/RawPtr.h"

Go to the source code of this file.

Classes

class  AutoPtr< T >
 Wrapper of pointer that deletes the resource from destructor. More...
 

Namespaces

 std
 Overload of std::swap for Sph::Array.
 

Functions

template<typename T >
bool operator== (const AutoPtr< T > &ptr, std::nullptr_t)
 
template<typename T >
bool operator== (std::nullptr_t, const AutoPtr< T > &ptr)
 
template<typename T >
bool operator!= (const AutoPtr< T > &ptr, std::nullptr_t)
 
template<typename T >
bool operator!= (std::nullptr_t, const AutoPtr< T > &ptr)
 
template<typename T , typename... TArgs>
INLINE AutoPtr< T > makeAuto (TArgs &&... args)
 
template<typename T1 , typename T2 >
INLINE AutoPtr< T1 > dynamicCast (AutoPtr< T2 > &&source)
 Performs a dynamic_cast on an AutoPtr, moving the ownership of the resource to the created object. More...
 
template<typename T >
void std::swap (Sph::AutoPtr< T > &p1, Sph::AutoPtr< T > &p2)
 

Detailed Description

Simplified implementation of std::unique_ptr, using only default deleter.

Author
Pavel Sevecek (sevecek at sirrah.troja.mff.cuni.cz)
Date
2016-2021

Definition in file AutoPtr.h.

Function Documentation

◆ dynamicCast()

template<typename T1 , typename T2 >
INLINE AutoPtr<T1> dynamicCast ( AutoPtr< T2 > &&  source)

Performs a dynamic_cast on an AutoPtr, moving the ownership of the resource to the created object.

If the dynamic type of given pointer is not T1 (or derived from T1), the function return nullptr and the resource remains owned by the input AutoPtr (no move is performed).

Definition at line 133 of file AutoPtr.h.

◆ makeAuto()

template<typename T , typename... TArgs>
INLINE AutoPtr<T> makeAuto ( TArgs &&...  args)

Definition at line 124 of file AutoPtr.h.

◆ operator!=() [1/2]

template<typename T >
bool operator!= ( const AutoPtr< T > &  ptr,
std::nullptr_t   
)

Definition at line 114 of file AutoPtr.h.

◆ operator!=() [2/2]

template<typename T >
bool operator!= ( std::nullptr_t  ,
const AutoPtr< T > &  ptr 
)

Definition at line 119 of file AutoPtr.h.

◆ operator==() [1/2]

template<typename T >
bool operator== ( const AutoPtr< T > &  ptr,
std::nullptr_t   
)

Definition at line 104 of file AutoPtr.h.

◆ operator==() [2/2]

template<typename T >
bool operator== ( std::nullptr_t  ,
const AutoPtr< T > &  ptr 
)

Definition at line 109 of file AutoPtr.h.