Public Types | Public Member Functions
efl::eina::optional< T & > Struct Template Reference

Public Types

typedef optional< T & > _self_type
 Type for the optional class itself. More...
 

Public Member Functions

constexpr optional (std::nullptr_t)
 Create a disengaged object. More...
 
constexpr optional ()
 Default constructor. More...
 
 optional (T &other)
 Create an engaged object by moving other content. More...
 
 optional (_self_type const &other)=default
 Copy constructor. More...
 
_self_typeoperator= (_self_type const &other)=default
 Assign new content to the object. More...
 
void disengage ()
 Disengage the object, destroying the current contained value, if any.
 
 operator bool () const
 Convert to bool based on whether the object is engaged or not. More...
 
bool operator! () const
 Convert to bool based on whether the object is engaged or not. More...
 
T * operator-> ()
 Access member of the contained value. More...
 
T const * operator-> () const
 Access constant member of the contained value. More...
 
T & operator* ()
 Get the contained value. More...
 
T const & operator* () const
 Get the contained value. More...
 
T & get ()
 Get the contained value. More...
 
T const & get () const
 Get the contained value. More...
 
void swap (optional< T > &other)
 Swap content with another eina::optional object. More...
 
bool is_engaged () const
 Check if the object is engaged. More...
 

Member Typedef Documentation

§ _self_type

template<typename T >
typedef optional<T&> efl::eina::optional< T & >::_self_type

Type for the optional class itself.

Constructor & Destructor Documentation

§ optional() [1/4]

template<typename T >
constexpr efl::eina::optional< T & >::optional ( std::nullptr_t  )
inline

Create a disengaged object.

This constructor creates a disengaged eina::optional object.

§ optional() [2/4]

template<typename T >
constexpr efl::eina::optional< T & >::optional ( )
inline

Default constructor.

Create a disengaged object.

§ optional() [3/4]

template<typename T >
efl::eina::optional< T & >::optional ( T &  other)
inline

Create an engaged object by moving other content.

Parameters
otherR-value reference to the desired type.

This constructor creates an eina::optional object in an engaged state. The contained value is initialized by moving other.

§ optional() [4/4]

template<typename T >
efl::eina::optional< T & >::optional ( _self_type const &  other)
default

Copy constructor.

Create an object containing the same value as other and in the same state.

Parameters
otherConstant reference to another eina::optional object that holds the same value type.

This constructor creates an eina::optional object with the same engagement state of other. If other is engaged then the contained value of the newly created object is initialized by copying the contained value of other.

Member Function Documentation

§ operator=()

template<typename T >
_self_type& efl::eina::optional< T & >::operator= ( _self_type const &  other)
default

Assign new content to the object.

Parameters
otherConstant reference to another eina::optional object that holds the same value type.

This operator replaces the current content of the object. If other is engaged its contained value is copied to this object, making *this be considered engaged too. If other is disengaged *this is also made disengaged and its contained value, if any, is simple destroyed.

§ operator bool()

template<typename T >
efl::eina::optional< T & >::operator bool ( ) const
inlineexplicit

Convert to bool based on whether the object is engaged or not.

Returns
true if the object is engaged, false otherwise.

§ operator!()

template<typename T >
bool efl::eina::optional< T & >::operator! ( ) const
inline

Convert to bool based on whether the object is engaged or not.

Returns
true if the object is disengaged, false otherwise.

§ operator->() [1/2]

template<typename T >
T* efl::eina::optional< T & >::operator-> ( )
inline

Access member of the contained value.

Returns
Pointer to the contained value, whose member will be accessed.

§ operator->() [2/2]

template<typename T >
T const* efl::eina::optional< T & >::operator-> ( ) const
inline

Access constant member of the contained value.

Returns
Constant pointer to the contained value, whose member will be accessed.

§ operator*() [1/2]

template<typename T >
T& efl::eina::optional< T & >::operator* ( )
inline

Get the contained value.

Returns
Reference to the contained value.

§ operator*() [2/2]

template<typename T >
T const& efl::eina::optional< T & >::operator* ( ) const
inline

Get the contained value.

Returns
Constant reference to the contained value.

§ get() [1/2]

template<typename T >
T& efl::eina::optional< T & >::get ( )
inline

Get the contained value.

Returns
Reference to the contained value.

§ get() [2/2]

template<typename T >
T const& efl::eina::optional< T & >::get ( ) const
inline

Get the contained value.

Returns
Constant reference to the contained value.

§ swap()

template<typename T >
void efl::eina::optional< T & >::swap ( optional< T > &  other)
inline

Swap content with another eina::optional object.

Parameters
otherAnother eina::optional object.

References efl::eina::swap().

§ is_engaged()

template<typename T >
bool efl::eina::optional< T & >::is_engaged ( ) const
inline

Check if the object is engaged.

Returns
true if the object is currently engaged, false otherwise.