#ifndef VOL_RESULT_H #define VOL_RESULT_H template class result; template class error { template friend class result; private: E err; public: error(E err) : err(err) {}; }; template class result { private: bool is_ok; T value; E err; public: result(T val) : value(val), is_ok(true) { } result(error err) : err(err.err), is_ok(false) { } ~result() = default; operator bool() const; bool ok() const; T* operator*(); T* operator->(); T unwrap(); const T unwrap() const; }; #endif /* VOL_RESULT_H */