template<typename GuardedType, typename LockType = pw::sync::VirtualBasicLockable>
class pw::sync::BorrowedPointer< GuardedType, LockType >
The BorrowedPointer is an RAII handle which wraps a pointer to a borrowed object along with a held lock which is guarding the object. When destroyed, the lock is released.
template<typename GuardedType , typename LockType = pw::sync::VirtualBasicLockable>
template<typename G , typename L >
Move-constructs a BorrowedPointer<T> from a BorrowedPointer<U>.
This allows not only pure move construction where GuardedType == G and Lock == L, but also converting construction where GuardedType is a base class of OtherType and Lock is a base class of OtherLock, like BorrowedPointer<Base> base_ptr(derived_borrowable.acquire());
- Postcondition
- The other BorrowedPointer is no longer valid and will assert if the GuardedType is accessed.
template<typename GuardedType , typename LockType = pw::sync::VirtualBasicLockable>
template<typename G , typename L >
Move-assigns a BorrowedPointer<T> from a BorrowedPointer<U>.
This allows not only pure move construction where GuardedType == OtherType and Lock == OtherLock, but also converting construction where GuardedType is a base class of OtherType and Lock is a base class of OtherLock, like BorrowedPointer<Base> base_ptr = derived_borrowable.acquire();
Postcondition: The other BorrowedPointer is no longer valid and will assert if the GuardedType is accessed.