12#include <boost/optional.hpp>
16#pragma warning(disable:4583)
17#pragma warning(disable:4582)
18#include <boost/variant2/variant.hpp>
21#include <boost/variant2/variant.hpp>
37 const std::string &
What()
const {
41 MSGPACK_DEFINE_ARRAY(
_what)
47 std::string
_what{
"unknown error"};
60 template <
typename TValue>
63 template <
typename TValue>
65 _data = std::forward<TValue>(value);
69 return _data.index() == 0;
72 template <
typename... Ts>
79 return boost::variant2::get<error_type>(
_data);
84 return boost::variant2::get<value_type>(
_data);
89 return boost::variant2::get<value_type>(
_data);
92 operator bool()
const {
96 MSGPACK_DEFINE_ARRAY(
_data)
100 boost::variant2::variant<error_type, value_type>
_data;
112 return success_flag{};
120 return _data.has_value();
123 template <
typename... Ts>
133 operator bool()
const {
137 MSGPACK_DEFINE_ARRAY(
_data)
141 struct success_flag {};
#define DEBUG_ASSERT(predicate)
const std::string & What() const
ResponseError(std::string message)
Response(ResponseError error)
static Response Success()
void SetError(Ts &&... args)
boost::optional< error_type > _data
const error_type & GetError() const
void Reset(TValue &&value)
const value_type & Get() const
boost::variant2::variant< error_type, value_type > _data
void SetError(Ts &&... args)
const error_type & GetError() const