class ov::optional

Overview

Store optional object of type T (basic version of std::optional). More…

#include <ov_optional.hpp>

template <class T>
class optional
{
public:
    // structs

    struct Empty;

    // unions

    template <class U>
    union Storage;

    // construction

    optional();

    template <class... Args>
    optional(Args&&... args);

    optional(const optional<T>& other);
    optional(optional<T>&& other);

    // methods

    optional& operator = (const optional& other);
    optional& operator = (optional&& other);

    template <class U = T>
    optional& operator = (U&& value);

    constexpr operator bool () const;
    constexpr const T& operator\* () const;
    T& operator\* ();
    constexpr const T&& operator\* () const;
    T&& operator\* ();
    constexpr const T \* operator -> () const;
    T \* operator -> ();
    void reset();

    template <class... Args>
    void emplace(Args&&... args);
};

Detailed Documentation

Store optional object of type T (basic version of std::optional).

If cpp17 used this class should be replaced by std::optional.

Parameters:

T

Type of stored object.