#pragma once #include "asl/meta.hpp" #include "asl/maybe_uninit.hpp" namespace asl { struct nullopt_t {}; static constexpr nullopt_t nullopt{}; template class option { maybe_uninit m_payload; bool m_has_value = false; public: constexpr option() = default; constexpr option(nullopt_t) {} // NOLINT(*-explicit-conversions) constexpr ~option() = default; constexpr ~option() requires (!trivially_destructible) { if (m_has_value) { m_payload.uninit_unsafe(); } } }; } // namespace asl