33 #if defined(CowPtr_RECURSES)
34 #error Recursive header files inclusion detected in CowPtr.h
35 #else // defined(CowPtr_RECURSES)
37 #define CowPtr_RECURSES
46 #include <type_traits>
47 #include "DGtal/base/Common.h"
48 #include "DGtal/base/CountedPtr.h"
117 const T*
get() const noexcept {
return myPtr.get();}
138 template < typename U = T, typename std::enable_if< ! std::is_const<U>::value >::type* =
nullptr >
141 template < typename U = T, typename std::enable_if< ! std::is_const<U>::value >::type* =
nullptr >
144 template < typename U = T, typename std::enable_if< ! std::is_const<U>::value >::type* =
nullptr >
155 return get() == other;
166 return get() != other;
188 if (!
myPtr.unique()) {
189 T* old_p =
myPtr.get();
227 template <
typename T>
236 #include "DGtal/base/CowPtr.ih"
241 #endif // !defined CowPtr_h
243 #undef CowPtr_RECURSES
244 #endif // else defined(CowPtr_RECURSES)
const T & operator*() const noexcept
const T * get() const noexcept
CowPtr(const CountedPtr< T > &r, bool)
const T * operator->() const noexcept
bool operator==(const T *other) const
void selfDisplay(std::ostream &out) const
CowPtr(const CowPtr &r) noexcept
DGtal is the top-level namespace which contains all DGtal functions and types.
bool unique() const noexcept
Aim: Smart pointer based on reference counts.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
unsigned int count() const
CowPtr & operator=(const CowPtr &r)
Aim: Copy on write shared pointer.
bool operator!=(const T *other) const