Lumiera
0.pre.03
»edit your freedom«
|
Go to the source code of this file.
Singleton-style holder for NIL or default values.
This template allows to maintain a "Null Object" value, with type-based access. It is implemented as a cluster of Meyer's Singletons, thus the creation happens on demand, and the destruction happens "sometime" during application shutdown. Contrary to the generic lumiera Singleton holder, this implementation is lightweight and without any further prerequisites and validity checks.
Employing the NIL object pattern instead of NULL pointers typically leads to greatly simplified and more robust code. Usually the only problem is these NIL marker objects need to exist somewhere. In case no factory is used for object creation, this NullValue holder might satisfy this need.
NIL objects are assumed to be default constructible for now. Initialisation may introduce a race, which is considered acceptable here, as these objects are assumed to be simple, constant and value-like.
Definition in file null-value.hpp.
Classes | |
struct | NullValue< TY > |
Singleton holder for NIL or default value objects. More... | |
Namespaces | |
lib | |
Implementation namespace for support and library code. | |