optional.hpp

Audited implementation of std::optional. Status: RELEASE.

Drop-in replacements for std::optional. In debug mode, operator * and operator-> value accesses are checked for undefined behavior.

Functions

template<class T>
constexpr optional<std::decay_t<T>> make_optional(T &&value)
template<class T, class ...Args>
constexpr optional<T> make_optional(Args&&... args)
template<class T, class Elem, class ...Args>
constexpr optional<T> make_optional(std::initializer_list<Elem> il, Args&&... args)
template<class T>
class optional : public std::optional<T>
#include <optional.hpp>

Public Functions

inline constexpr const T *operator->() const
inline constexpr T *operator->()
inline constexpr const T &operator*() const &
inline constexpr T &operator*() &
inline constexpr T &&operator*() &&
inline constexpr const T &&operator*() const &&

Private Types

using parent_t = std::optional<T>