class Core::_detail::Nullable

Manages an optional contained value, i.e. a value that may or may not be present.

Parameters

  • T A type to represent contained values.

Members

m_disengaged

Syntax: public NontrivialEmptyType m_disengaged;

m_value

Syntax: public T m_value;

Nullable

Syntax: public inline constexpr Nullable ( );

Constructs a Nullable that represents the absence of value.

Nullable

Syntax: public inline constexpr Nullable ( T initialValue );

Constructs a Nullable having an initialValue.

Parameters

  • initialValue A non-absent value to initialize with.

Nullable

Syntax: public inline Nullable ( const Nullable & other );

Constructs a Nullable by copying another Nullable.

Parameters

  • other Another Nullable instance to copy.

Nullable

Syntax: public inline Nullable ( Nullable && other );

Constructs a Nullable by moving in another Nullable.

Parameters

  • other A Nullable instance to move into the instance being constructed.

~Nullable

Syntax: public inline ~Nullable ( );

Destructs the Nullable, calling the destructor for the contained value if there is one.

Reset

Syntax: public inline void Reset ( ) noexcept;

Destructs the contained value, if there is one.

Swap

Syntax: public inline void Swap ( Nullable & other );

Exchanges the contents.

Parameters

  • other An instance to exchange the contents with.

operator=

Syntax: public inline Nullable & operator= ( const Nullable & other );

Assignment operator.

Parameters

  • other A reference to a Nullable object.

Returns

A reference to the instance being assigned.

operator=

Syntax: public inline Nullable & operator= ( Nullable && other );

Assignment operator with move semantics.

Parameters

  • other A reference to a Nullable object.

Returns

A reference to the instance being assigned.

operator=

Syntax: public template< > inline Nullable & operator= ( U && other );

Assignment operator from another type.

Parameters

  • U Type of other.

Parameters

  • other Other Core::_detail::Nullable.

Returns

A reference to the instance being assigned.

Emplace

Syntax: public template< > inline T & Emplace ( U &&... args );

Construct the contained value in-place.

If this instance already contains a value before the call, the contained value is destroyed by calling its destructor.

Parameters

  • args Arguments to forward to the constructor of the contained value.

Returns

A reference to the instance being constructed.

HasValue

Syntax: public inline bool HasValue ( ) const noexcept;

Check whether a value is contained.

Returns

true If a value is contained, false if value is absent.

Value

Syntax: public inline const T & Value ( ) const noexcept;

Get the contained value.

Returns

A reference to the contained value.

Value

Syntax: public inline T & Value ( ) noexcept;

Get the contained value reference.

Returns

A reference to the contained value.

Value

Syntax: public inline T && Value ( ) noexcept;

Get the contained value (as rvalue reference).

Returns

A rvalue reference to the contained value.

operator bool

Syntax: public inline constexpr explicit operator bool ( ) const noexcept;

operator bool on the condition of Core::_detail::Nullable::HasValue.

Returns

true If a value is contained, false if value is absent.

operator->

Syntax: public inline constexpr const T * operator-> ( ) const;

Accesses the contained value.

Returns

Returns a pointer to the contained value.

The behavior is undefined if *this does not contain a value.

This operator does not check whether the Nullable contains a value! You can do so manually by using HasValue() or simply operator bool(). Alternatively, if checked access is needed, GetValue() or ValueOr() may be used.

operator->

Syntax: public inline constexpr T * operator-> ( );

Accesses the contained value.

Returns

Returns a pointer to the contained value.

The behavior is undefined if *this does not contain a value.

This operator does not check whether the Nullable contains a value! You can do so manually by using HasValue() or simply operator bool(). Alternatively, if checked access is needed, GetValue() or ValueOr() may be used.

operator*

Syntax: public inline constexpr const T & operator* ( ) const;

Accesses the contained value.

Returns

Returns a reference to the contained value.

The behavior is undefined if *this does not contain a value.

This operator does not check whether the Nullable contains a value! You can do so manually by using HasValue() or simply operator bool(). Alternatively, if checked access is needed, GetValue() or ValueOr() may be used.

operator*

Syntax: public inline constexpr T & operator* ( );

Accesses the contained value.

Returns

Returns a reference to the contained value.

The behavior is undefined if *this does not contain a value.

This operator does not check whether the Nullable contains a value! You can do so manually by using HasValue() or simply operator bool(). Alternatively, if checked access is needed, GetValue() or ValueOr() may be used.

operator*

Syntax: public inline constexpr T && operator* ( );

Accesses the contained value.

Returns

Returns a reference to the contained value.

The behavior is undefined if *this does not contain a value.

This operator does not check whether the Nullable contains a value! You can do so manually by using HasValue() or simply operator bool(). Alternatively, if checked access is needed, GetValue() or ValueOr() may be used.

operator*

Syntax: public inline constexpr const T && operator* ( ) const;

Accesses the contained value.

Returns

Returns a reference to the contained value.

The behavior is undefined if *this does not contain a value.

This operator does not check whether the Nullable contains a value! You can do so manually by using HasValue() or simply operator bool(). Alternatively, if checked access is needed, GetValue() or ValueOr() may be used.

ValueOr

Syntax: public template< > inline constexpr std::remove_cv< T >::type ValueOr ( U && other ) const;

Get the contained value, returns other if value is absent.

Parameters

  • other A value to return when no value is contained.

Returns

A contained value (when present), or other.

ValueOr

Syntax: public template< > inline constexpr std::remove_cv< T >::type ValueOr ( U && other );

Get the contained value, returns other if value is absent.

Parameters

  • other A value to return when no value is contained.

Returns

A contained value (when present), or other.