Template Class Optional¶
Defined in File DlOptional.hpp
Class Documentation¶
-
template<typename T>
class Optional¶ Class to manage a value that may or may not exist. The boolean value of the Optional class is true if the object contains a value and false if it does not contain a value.
The class must be evaluated and confirmed as true (containing a value) before being dereferenced.
Public Types
Public Functions
-
Optional()¶
The default constructor is set to not have any value, and is therefore evaluated as false.
-
template<typename Q = T>
Optional(const T &v, typename std::enable_if<!std::is_pointer<Q>::value>::type* = 0)¶ Construct an Optional class using an object.
- Parameters
Reference – [in] to an object v
Optional – instance of object v
-
template<typename Q = T>
Optional(U *v, LIFECYCLE type, typename std::enable_if<std::is_pointer<Q>::value>::type* = 0)¶ Construct an Optional class using an object.
- Parameters
Reference – [in] to an object v
type – [in] of object
typename – [in] of object
Optional – instance of object v
-
Optional(const Optional &other)¶
Construct an Optional class using an object.
- Parameters
Reference – [in] to an object other
-
Optional &operator=(const Optional &other) noexcept¶
Construct an Optional class using an object.
- Parameters
Reference – [in] to an object v
Optional – instance of object v
-
Optional(Optional &&other) noexcept¶
Construct an Optional class using an object.
- Parameters
Reference – [in] to an object other
-
Optional &operator=(Optional &&other) noexcept¶
Construct an Optional class using an object.
- Parameters
Reference – [in] to an object v
Optional – instance of object v
-
~Optional()¶
Destructor of Otional class object.
-
operator bool() const noexcept¶
Boolean value of Optional class is only true when there exists a value.
-
bool operator!() const noexcept¶
Boolean value of Optional class is only true when there does not exist a value.
-
const T &operator*()¶
Get reference of Optional object.
Warning
User must validate Optional has value before.
-
const T &operator*() const¶
Get reference of Optional object.
Warning
User must validate Optional has value before.
-
operator T&()¶
Get reference of Optional object.
Warning
User must validate Optional has value before.
-
T operator->()¶
Get reference of Optional object.
Warning
User must validate Optional has value before.
-
void release()¶
Releases the ownership of shared pointer m_Count.
-
Optional()¶