#ifndef DYNINST_DYNCOMPAT_OPTIONAL_HPP #define DYNINST_DYNCOMPAT_OPTIONAL_HPP #include #include #include namespace dyncompat { template class optional : public std::optional { using base = std::optional; public: using base::base; using base::operator=; optional() = default; optional(const optional&) = default; optional(optional&&) = default; optional(const base& other) : base(other) {} optional(base&& other) : base(std::move(other)) {} optional& operator=(const optional&) = default; optional& operator=(optional&&) = default; optional& operator=(const base& other) { base::operator=(other); return *this; } optional& operator=(base&& other) { base::operator=(std::move(other)); return *this; } T& get() { return this->value(); } const T& get() const { return this->value(); } }; using std::nullopt; using std::nullopt_t; template optional> make_optional(T&& value) { return optional>(std::forward(value)); } } // namespace dyncompat #endif