explicit operator bool() const { return raw; }
/// Returns raw and possibly NULL pointer
T *get() const { return raw; }
- /// Address of the raw pointer, for pointer-setting functions
- T **addr() { return &raw; }
+
/// Reset raw pointer - delete last one and save new one.
void reset(T *t) {
deletePointer();
}
#if __cplusplus >= 201103L
- explicit LockingPointer(LockingPointer<T, DeAllocator, lock> &&o): Parent(o.get()) {
- *o.addr() = nullptr;
+ explicit LockingPointer(LockingPointer<T, DeAllocator, lock> &&o): Parent(o.release()) {
}
LockingPointer<T, DeAllocator, lock> &operator =(LockingPointer<T, DeAllocator, lock> &&o) {
- if (o.get() != this->get()) {
- this->reset(o.get());
- *o.addr() = nullptr;
- }
+ if (o.get() != this->get())
+ this->reset(o.release());
return *this;
}
#endif