RAII pin. More...
#include <slot.hpp>
Public Member Functions | |
| ReadGuard () noexcept=default | |
| ReadGuard (const ReadGuard &)=delete | |
| ReadGuard & | operator= (const ReadGuard &)=delete |
| ReadGuard (ReadGuard &&other) noexcept | |
| ~ReadGuard () | |
| T * | get () const noexcept |
| T & | operator* () const noexcept |
| T * | operator-> () const noexcept |
| operator bool () const noexcept | |
Friends | |
| class | Slot |
RAII pin.
While one exists, the value it points at cannot be reclaimed. Holding a guard across a block boundary is legal but pointless; hold it exactly as long as you dereference.
read() is const because pinning does not change the slot — it bumps a mutable counter. The pinned object is handed back as T*, so a Slot<const T> yields const T* and a Slot<T> yields a mutable one.
|
defaultnoexcept |
|
delete |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
|
inlineexplicitnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
delete |
|
friend |