31 template<
typename __C>
42 refCount =
new unsigned int;
55 refCount =
new unsigned int;
66 refCount(other.refCount)
104 refCount = other.refCount;
112 if (NULL == ptr || NULL == other.ptr)
114 if (NULL == ptr && NULL == other.ptr)
120 return ((*ptr) == (*other.ptr));
125 if (NULL == ptr || NULL == other.ptr)
127 if (NULL == ptr && NULL == other.ptr)
133 return ((*ptr) != (*other.ptr));
138 if (NULL == ptr || NULL == other.ptr)
140 if (NULL == ptr && NULL == other.ptr)
153 return ((*ptr) < (*other.ptr));
160 operator __C*()
const {
return ptr;}
161 operator const __C*()
const {
return (
const __C*) ptr;}
166 unsigned int* refCount;
171 #endif // SMARTPTR_HPP_
bool operator!=(const SmartPtr &other) const
Definition: SmartPtr.hpp:123
~SmartPtr()
Destructor. Decrements reference count, if it drops to 0 frees managed data.
Definition: SmartPtr.hpp:75
Smart pointer implementation for safely passing around dynamically created data. Smart pointers are r...
Definition: SmartPtr.hpp:32
SmartPtr()
Default constructor.
Definition: SmartPtr.hpp:38
SmartPtr & operator=(const SmartPtr &other)
Assignment operator Creates new SmartPtr from other instance of SmartPtr increasing its reference cou...
Definition: SmartPtr.hpp:91
SmartPtr(__C *p)
Constructor. Creates new SmartPtr from given pointer.
Definition: SmartPtr.hpp:51
bool operator==(const SmartPtr &other) const
Definition: SmartPtr.hpp:110
__C * operator->() const
Definition: SmartPtr.hpp:156
__C & operator*() const
Definition: SmartPtr.hpp:157
SmartPtr(const SmartPtr &other)
Copy constructor. Creates new SmartPtr from other instance of SmartPtr increasing its reference count...
Definition: SmartPtr.hpp:64
bool operator<(const SmartPtr &other) const
Definition: SmartPtr.hpp:136
__C * getPointer() const
Definition: SmartPtr.hpp:158