Skip to content
Snippets Groups Projects
Commit f2cd0170 authored by Oliver Sander's avatar Oliver Sander
Browse files

add missing method 'reset()'

[[Imported from SVN: r5733]]
parent 26ff3316
No related branches found
No related tags found
No related merge requests found
......@@ -90,6 +90,11 @@ namespace Dune
/** \brief Dereference as const pointer */
inline const element_type* operator->() const;
/** \brief Decrease the reference count by one and free the memory if the
reference count has reached 0
*/
inline void reset();
/**
* @brief Deallocates the references object if no other
* pointers reference it.
......@@ -183,6 +188,15 @@ namespace Dune
return rep_->count_;
}
template<class T>
inline void shared_ptr<T>::reset()
{
if(rep_!=0 && --(rep_->count_)==0) {
delete rep_;
rep_=0;
}
}
template<class T>
inline void shared_ptr<T>::deallocate()
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment