You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
1.1 KiB
21 lines
1.1 KiB
2 years ago
|
|
||
|
#include "macros.hh"
|
||
|
|
||
|
namespace error {
|
||
|
struct Error {
|
||
|
DEFINE_INTERFACE(Error);
|
||
|
constexpr Error() noexcept = default;
|
||
|
|
||
|
constexpr operator std::string_view() const noexcept { return message(); }
|
||
|
|
||
|
constexpr virtual std::string_view message() const noexcept =0;
|
||
|
constexpr virtual Error const* inner() const noexcept { return nullptr; }
|
||
|
|
||
|
// TODO: `borrow::Borrow<typename T, where::deref_to<T> (using std::pointer_traits<>) PtrType = T*>` (borrow.hh): essentially specialised `std::variant<T, PtrType>`
|
||
|
constexpr virtual borrow::Borrow<const Report> report() const& { return borrow::Borrow{ nullptr }; }
|
||
|
// constexpr virtual borrow::Borrow<const Report> report() & { return borrow::Borrow{ nullptr }; }
|
||
|
constexpr virtual borrow::Borrow<Report> report() & { return borrow::Borrow{ nullptr }; }
|
||
|
constexpr virtual borrow::Borrow<Report>:into_owned_t report() && { return borrow::Borrow{ nullptr }.into_owned(); } // <- Will initialise with `into_owned() &&` member function, which `std::move()`s the value from the pointer instead of just copying the pointer. XXX: How do we actually want this borrowing interface to behave, huh?
|
||
|
};
|
||
|
}
|