![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
RefPtr are a replacement for the usual pointers: they keep track of the number of "smart" pointers pointing to a given element. More...
RefPtr are a replacement for the usual pointers: they keep track of the number of "smart" pointers pointing to a given element.
When an element is no more referenced by any smart pointer, it is deleted. Hence using RefPtr, developers do not have to worry anymore about memory leaks. The correct way to use RefPtr is by creating unnamed temporaries like:
In any case, if you decide to pass a named pointer as argument to a RefPtr, make sure you will do it only once, that it is allocated on the heap and that you never try to deallocate it yourself, else your program will crash.
Classes | |
class | gum::RefPtr< Val > |
Smart pointersaGrUM's smart pointers keep track of the number of times the value they point to is referenced. More... | |
Functions | |
template<typename Val > | |
void | gum::swap (RefPtr< Val > &ptr1, RefPtr< Val > &ptr2) |
Swap the contents of two RefPtr. More... | |
Swap the contents of two RefPtr.
The swap function must access to gum::RefPtr private parts.
Definition at line 251 of file refPtr_tpl.h.
References gum::Set< Key, Alloc >::emplace().