#pragma once #include #include #include namespace mbgl { namespace android { namespace conversion { struct Error { std::string message; }; template class Result : private variant { public: using variant::variant; explicit operator bool() const { return this->template is(); } T& operator*() { assert(this->template is()); return this->template get(); } const T& operator*() const { assert(this->template is()); return this->template get(); } const Error& error() const { assert(this->template is()); return this->template get(); } }; template struct Converter; template Result convert(jni::JNIEnv& env, const V& value, Args&&...args) { return Converter()(env, value, std::forward(args)...); } } // namespace conversion } // namespace android } // namespace mbgl