#pragma once #include "exopt.h" #include "optional.h" #include "util.hh" namespace exopt { class Report { virtual ~Report(); }; class Error { constexpr Error() = default; constexpr Error(Error const&) = default; constexpr Error(Error &&) = default; constexpr Error& operator=(Error &&) = default; constexpr Error& operator=(Error const&) = default; constexpr virtual std::string_view message() const noexcept =0; constexpr virtual MaybeOwnedRef inner() noexcept { return {}; } //TODO: Maybe just use `std::optional>` constexpr virtual MaybeOwned into_report() noexcept { /* TODO */ } // XXX: ^^ constexpr virtual MaybeOwned into_report() && noexcept { /* TODO: auto{*this}.into_report() */ } constexpr virtual ~Error() = default; protected: private: }; }