|
mod_servlet
C++Servlets
|
Class implements smart pointer with optional ownership. More...
#include <optional.h>
Public Types | |
| typedef T | value_type |
| Type definition for value type. | |
| typedef T * | pointer |
| Type definition for pointer type. | |
| typedef const T * | const_pointer |
| Type definition for const pointer type. | |
Public Member Functions | |
| constexpr | optional_ptr () |
| Default constructor. More... | |
| constexpr | optional_ptr (T *ptr, bool owner=false) |
| Constructor which creates the object with a given pointer and specified ownership. More... | |
| constexpr | optional_ptr (const optional_ptr &other)=delete |
| Copy contructor. More... | |
| constexpr | optional_ptr (optional_ptr &&other) |
| Move constructor. More... | |
| ~optional_ptr () noexcept | |
| Destructor. More... | |
| constexpr void | clear () |
| Clears the object. More... | |
| constexpr optional_ptr & | operator= (const optional_ptr &other)=delete |
| Copy is prohibited. | |
| constexpr optional_ptr & | operator= (optional_ptr &&other) noexcept |
| Move assignment. More... | |
| constexpr optional_ptr & | assign (T *ptr, bool owner=false) |
| Assigns new pointer to this object. 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 bool | is_owner () const noexcept |
| Checks whether this object is the owner of the contained pointer. More... | |
| constexpr T * | operator-> () |
| Accesses the contained pointer. More... | |
| constexpr const T * | operator-> () const |
| const version of pointer accessor More... | |
| constexpr T & | operator* ()& |
| Accesses the contained pointer. More... | |
| constexpr const T & | operator* () const & |
| Accesses the contained pointer. More... | |
| constexpr void | swap (optional_ptr &other) noexcept |
| Swaps the contents with those of other. More... | |
| constexpr void | reset () noexcept |
| If this object contains a valid pointer, delete that. More... | |
Class implements smart pointer with optional ownership.
If the object owns the contained pointer it will delete the pointer on destruction, otherwise the contained pointer will not be deleted.
| the | type of the value to manage. |
|
inline |
Default constructor.
Creates empty object with nullptr as the contained pointer.
|
inline |
Constructor which creates the object with a given pointer and specified ownership.
| ptr | Pointer to contain in optional_ptr |
| owner | Ownership flag. |
|
delete |
Copy contructor.
| other | object to copy. |
|
inline |
Move constructor.
| other | object to move. |
|
inlinenoexcept |
Destructor.
If the object contains the valid pointer and is the owner of it, deletes this pointer. Otherwise, does nothing.
|
inline |
Assigns new pointer to this object.
If this object already contains a valid pointer and is the owner it will delelete it before the assignment.
| ptr | new pointer to assign |
| owner | ownership flag |
|
inline |
Clears the object.
This method will delete the contained pointer if it is an owner, drop the * pointer to nullptr and reset the ownership flag to false
|
inlinenoexcept |
Checks whether this object contains valid pointer.
true if this object contains valid pointer, false otherwise.
|
inlinenoexcept |
Checks whether this object is the owner of the contained pointer.
true if this object is the owner of the contained pointer, false otherwise.
|
inlineexplicitnoexcept |
Checks whether this object contains valid pointer.
true if this object contains valid pointer, false otherwise.
|
inline |
Accesses the contained pointer.
| null_pointer_exception | if the contained pointer is nullptr. |
|
inline |
Accesses the contained pointer.
| null_pointer_exception | if the contained pointer is nullptr. |
|
inline |
Accesses the contained pointer.
| null_pointer_exception | if the contained pointer is nullptr. |
|
inline |
const version of pointer accessor
| null_pointer_exception | if the contained pointer is nullptr. |
|
inlinenoexcept |
Move assignment.
If this object contains valid pointer and is the owner it will delete it before the assignment.
| other | the object to move |
|
inlinenoexcept |
If this object contains a valid pointer, delete that.
Otherwise, there are no effects.
|
inlinenoexcept |
Swaps the contents with those of other.
| other | the object to exchange the contents with |