template struct utils::StrongOptionalType

Overview

std::optional specialization of the Strong type pattern. More…

#include <StrongOptionalType.h>

template <typename ValueType, typename PhantomType>
struct StrongOptionalType: public utils::StrongType {
    // typedefs

    typedef std::optional<ValueType> OptionalValueType;

    // methods

    StrongOptionalType<ValueType, PhantomType>& operator=(const OptionalValueType& value);
    bool HasValue() const;
    const ValueType& Value() const;
};

Inherited Members

public:
    // methods

    template <typename RT>
    std::enable_if_t<std::is_arithmetic_v<RT>, RT> As() const;

    bool operator==(const StrongType& other) const;
    bool operator!=(const StrongType& other) const;
    bool operator<(const StrongType& other) const;
    bool operator>(const StrongType& other) const;
    const ValueType& operator*() const;

protected:
    // fields

    ValueType value_;

Detailed Documentation

std::optional specialization of the Strong type pattern.

Contains value() and has_value() functions to access the underlying optional.

Methods

bool HasValue() const

Proxy function to access the underlying optional’s has_value() function.

const ValueType& Value() const

Proxy function to access the underlying optional’s value() function.