|
ScL Feature 0.0.1
C++20 composable proxy wrapper with pluggable executor strategy
|
RAII guard providing access to the value held by a wrapper or a plain reference. More...
#include <wrapper_guard.h>
Public Member Functions | |
| wrapper_guard (Refer v) | |
Constructs the guard and acquires access to v. | |
| ~wrapper_guard () | |
| Releases the guard acquired at construction. | |
| decltype(auto) | value () const noexcept |
Returns the stored value with the same cv- and ref-qualifiers as Refer. | |
RAII guard providing access to the value held by a wrapper or a plain reference.
For wrapper types calls guard() on the executor at construction and unguard() at destruction (both are no-ops if the executor does not define them). Exposes value() to reach the stored value with the same cv- and ref-qualifiers as the incoming reference.
For non-wrapper types simply holds the reference; no guard/unguard is performed.
| Refer | Reference type — either wrapper<V,E> cv-ref or a plain value cv-ref. |
|
explicit |
Constructs the guard and acquires access to v.
For wrapper types calls executor_type::guard() immediately (if defined). For non-wrapper types simply stores the reference — no side effects.
| v | Reference to the wrapper or plain value to guard. |
| scl::wrapper_guard< Refer >::~wrapper_guard | ( | ) |
Releases the guard acquired at construction.
For wrapper types calls executor_type::unguard() (if defined). For non-wrapper types is a no-op.
|
nodiscardnoexcept |
Returns the stored value with the same cv- and ref-qualifiers as Refer.
For wrapper types delegates to executor_type::access(). For non-wrapper types returns the held reference unchanged.