G+Smo
24.08.0
Geometry + Simulation Modules
|
Provides utility function related to memory management. More...
Go to the source code of this file.
Namespaces | |
gismo | |
The G+Smo namespace, containing all definitions for the library. | |
gismo::memory | |
This namespace contains functions related to memory management. | |
gismo::util | |
the gsFuncData is a cache of pre-computed function sets values. | |
Functions | |
template<typename obj > | |
std::vector< obj * > | asVectorPtr (const std::vector< obj > &matv) |
Constructs a vector of pointers from a vector of objects. | |
template<typename Base , typename Derived > | |
std::vector< Base * > | castVectorPtr (std::vector< Derived * > pVec) |
Casts a vector of pointers. | |
template<typename Derived , typename Base > | |
bool | checkVectorPtrCast (std::vector< Base * > pVec) |
Returns true if all instances of Base cast to Derived. | |
template<typename It , typename ItOut > | |
void | cloneAll (It start, It end, ItOut out) |
Clones all pointers in the range [start end) and stores new raw pointers in iterator out. | |
template<typename ContIn , typename ContOut > | |
void | cloneAll (const ContIn &in, ContOut &out) |
Clones all pointers in the container in and stores them as raw pointers in container out. | |
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<class T , class U > | |
void | copy (T begin, T end, U *result) |
Small wrapper for std::copy mimicking std::copy for a raw pointer destination, copies n positions starting from begin into result. The latter is expected to have been allocated in advance. | |
template<class T , class U > | |
void | copy_n (T begin, const size_t n, U *result) |
Small wrapper for std::copy mimicking memcpy (or std::copy_n) for a raw pointer destination, copies n positions starting from begin into result. The latter is expected to have been allocated in advance. | |
template<typename It > | |
void | freeAll (It begin, It end) |
Frees all pointers in the range [begin end) | |
template<typename Cont > | |
void | freeAll (Cont &cont) |
Frees all pointers in the container Cont. | |
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 S > | |
S | give (S &x) |
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. | |
Provides utility function related to memory management.
This file is part of the G+Smo library.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
Author(s): C. Hofreither, A. Mantzaflaris, J. Vogl