G+Smo
24.08.0
Geometry + Simulation Modules
|
This namespace contains functions related to memory management. More...
Functions | |
template<class toC , typename from > | |
unique_ptr< toC > | convert_ptr (from p) |
Converts an uPtr p to an uPtr of class toC and gives it back as return value. | |
template<typename T > | |
std::vector< T * > | get_raw (const std::vector< unique_ptr< T > > &cont) |
Takes a vector of smart pointers and returns the corresponding raw pointers. | |
template<typename T > | |
std::vector< T * > | get_raw (const std::vector< shared_ptr< T > > &cont) |
Takes a vector of smart pointers and returns the corresponding raw pointers. | |
template<typename T > | |
shared_ptr< T > | make_shared (T *x) |
template<typename T > | |
shared_ptr< T > | make_shared_not_owned (const T *x) |
Creates a shared pointer which does not eventually delete the underlying raw pointer. Usefull to refer to objects which should not be destroyed. More... | |
template<typename T > | |
unique_ptr< T > | make_unique (T *x) |
template<typename T > | |
void | null_deleter (T *) |
Deleter function that does not delete an object pointer. | |
template<typename T > | |
std::vector< T * > | release (std::vector< unique_ptr< T > > &cont) |
Takes a vector of smart pointers, releases them and returns the corresponding raw pointers. | |
This namespace contains functions related to memory management.
|
inline |
Takes a T* and wraps it in a shared_ptr. Useful for avoiding memory leaks.
This has a move semantics: the shared_ptr object takes the ownership.
|
inline |
Creates a shared pointer which does not eventually delete the underlying raw pointer. Usefull to refer to objects which should not be destroyed.
The caller keeps the ownership.
|
inline |
Takes a T* and wraps it in an unique_ptr. Useful for one-off function return values to avoid memory leaks.
This has a move semantics: the unique_ptr object takes the ownership.