![]() |
Lumiera 0.pre.04
»edit your freedom«
|
Adapter to store and hold an element of arbitrary type in local storage. More...
Go to the source code of this file.
Adapter to store and hold an element of arbitrary type in local storage.
Notably, the difference between values and references can be levelled, while default construction or copy abilities are passed through. Such an inline container can be relevant for generic programming, especially to capture the result of an arbitrary function. This container can be created empty (which requires to store an additional state flag); the stored payload can be accessed through the dereferentiation operator (similar to a smart-ptr or to std::optional). The interface was shaped by its primary use case, which is to bind transforming functors into a processing pipeline, or for caching the result of a computation. Another use case is to circumvent the finiteness of references, to re-bind them to another target, or to replace an immutable object.
Definition in file item-wrapper.hpp.
#include "lib/error.hpp"#include "lib/nocopy.hpp"#include "lib/util.hpp"#include <cstddef>#include <utility>#include <type_traits>Namespaces | |
| namespace | lib |
| Implementation namespace for support and library code. | |
| namespace | lib::wrapper |
Classes | |
| class | ItemWrapper< TY > |
| Universal value/ref wrapper accessible similar to a pointer. More... | |
| class | ItemWrapper< TY & > |
| Specialisation of the ItemWrapper to deal with references, as if they were pointer values. More... | |
| class | ItemWrapper< void > |
Fallback-specialisation for ItemWrapper<void>. More... | |
Functions | |
| template<typename TY > | |
| bool | operator== (ItemWrapper< TY > const &w1, ItemWrapper< TY > const &w2) |
| allow equality comparison if the wrapped types are comparable | |
| template<typename TY > | |
| bool | operator!= (ItemWrapper< TY > const &w1, ItemWrapper< TY > const &w2) |