mod_servlet
C++Servlets
|
Optional reference implementation. More...
#include <optional.h>
Public Types | |
typedef T | value_type |
Type definition for value type. | |
typedef T & | reference |
Type definition for reference type. | |
typedef const T & | const_reference |
Type definition for constant reference type. | |
Public Member Functions | |
constexpr | optional_ref () noexcept |
Default constructor. More... | |
constexpr | optional_ref (T &obj) noexcept |
Constructs object that contains a reference to a given object,. More... | |
constexpr | optional_ref (const optional_ref &other) noexcept |
Copy constructor. More... | |
constexpr | optional_ref (optional_ref &&other) noexcept |
Move constructor. More... | |
~optional_ref () noexcept | |
Destructor. More... | |
constexpr optional_ref & | operator= (const optional_ref &other) noexcept |
Replaces contents of this object with the contents of other. More... | |
constexpr optional_ref & | operator= (optional_ref &&other) noexcept |
Move assignment. More... | |
constexpr optional_ref & | operator= (T &obj) noexcept |
Replaces contents of this object with the reference to other. More... | |
constexpr T * | operator-> () |
Accesses the contained value as a pointer. More... | |
constexpr const T * | operator-> () const |
Accesses the contained value as a constant pointer. More... | |
constexpr T & | operator* () |
Accesses the contained value as a reference. More... | |
constexpr const T & | operator* () const |
Accesses the contained value as a constant reference. More... | |
constexpr | operator bool () const noexcept |
Checks whether this object contains valid pointer. More... | |
constexpr bool | has_value () const noexcept |
Checks whether this object contains valid pointer. More... | |
constexpr T & | value ()& |
Accesses the contained value as a reference. More... | |
constexpr const T & | value () const & |
Accesses the contained value as a constant reference. More... | |
template<typename OT > | |
constexpr T | value_or (OT &&dflt) const &noexcept |
Returns the contained value if this has a value, otherwise returns given value. More... | |
constexpr void | swap (optional_ref &other) noexcept |
Swaps the contents with those of other. More... | |
constexpr void | reset () noexcept |
If this object contains a reference to an object, reset the pointer to that to nullptr . More... | |
Optional reference implementation.
It is resambles std::optional but doesn't copy the object, instead it stores the reference to the object and never attempts to destroy it. This object might be usefull when returning the object from container and it is not known up front if this object exists.
the | type of the value to manage. |
|
inlinenoexcept |
Default constructor.
Constructs the object that does not contain a reference to any value.
|
inlinenoexcept |
Constructs object that contains a reference to a given object,.
obj | Object to whcih this object will refere. |
|
inlinenoexcept |
Copy constructor.
other | object to copy. |
|
inlinenoexcept |
Move constructor.
other | object to move. |
|
inlinenoexcept |
Destructor.
Does nothing.
|
inlinenoexcept |
Checks whether this object contains valid pointer.
true
if this object contains valid pointer, false
otherwise.
|
inlineexplicitnoexcept |
Checks whether this object contains valid pointer.
true
if this object contains valid pointer, false
otherwise.
|
inline |
Accesses the contained value as a reference.
null_pointer_exception | if the contained pointer is nullptr . |
|
inline |
Accesses the contained value as a constant reference.
null_pointer_exception | if the contained pointer is nullptr . |
|
inline |
Accesses the contained value as a pointer.
null_pointer_exception | if the contained pointer is nullptr . |
|
inline |
Accesses the contained value as a constant pointer.
null_pointer_exception | if the contained pointer is nullptr . |
|
inlinenoexcept |
Replaces contents of this object with the contents of other.
other | object to assign |
|
inlinenoexcept |
Move assignment.
other | object to assign |
|
inlinenoexcept |
Replaces contents of this object with the reference to other.
obj | object to refere |
|
inlinenoexcept |
If this object contains a reference to an object, reset the pointer to that to nullptr
.
Otherwise, there are no effects.
|
inlinenoexcept |
Swaps the contents with those of other.
other | the object to exchange the contents with |
|
inline |
Accesses the contained value as a reference.
null_pointer_exception | if the contained pointer is nullptr . |
|
inline |
Accesses the contained value as a constant reference.
null_pointer_exception | if the contained pointer is nullptr . |
|
inlinenoexcept |
Returns the contained value if this has a value, otherwise returns given value.
dflt | the value to use in case this is empty |