Modifier that allows to create uninitialized Object(s) More...
#include </home/chochlik/devel/oglplus/include/oglplus/object/optional.hpp>
Inherits oglplus::Object< ObjectOps >.
Public Member Functions | |
OptionalImpl (void) | |
Construction of an uninitialized instance. More... | |
OptionalImpl (Object &&temp) | |
Construction of an initialized instance. More... | |
OptionalImpl (OptionalImpl &&temp) | |
Move constructor. | |
bool | IsInitialized (void) const |
Returns true if the object is initialized, false otherwise. More... | |
Object | Release (void) |
Releases the stored object and makes this Optional uninitialized. | |
Modifier that allows to create uninitialized Object(s)
The Optional template class is a modifier for Objects and in contrast to Objects it does allow to construct uninitialized instances which can be initialized later.
An Optional<Object> can be used everywhere an Object could be used, but it must be initialized (the IsInitialized() member function must return true), otherwise usage results in undefined behavior.
oglplus::OptionalImpl< tag::Object, Object >::OptionalImpl | ( | void | ) |
Construction of an uninitialized instance.
The only things that can safely be done with an uninitialized Optional<Object> is assignment, moving, destruction and checking whether it is initialized.
oglplus::OptionalImpl< tag::Object, Object >::OptionalImpl | ( | Object && | temp | ) |
Construction of an initialized instance.
Initialized Optional<Object> can be used everywhere where a plain Object could be used, furthermore Optional<Object> can also be cleared (this brings it in uninitialized state)
bool oglplus::OptionalImpl< tag::Object, Object >::IsInitialized | ( | void | ) | const |
Returns true if the object is initialized, false otherwise.
The only things that can safely be done with an uninitialized Optional<Object> is assignment, moving, destruction and checking whether it is initialized. On the other hand initialized Optional<Object> can be used everywhere where a plain Object could be used.