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)
48 std::string
_what{
"unknown error"};
61 template <
typename TValue>
62 Response(TValue &&value) : _data(
std::forward<TValue>(value)) {}
64 template <
typename TValue>
66 _data = std::forward<TValue>(value);
70 return _data.index() == 0;
73 template <
typename... Ts>
80 return boost::variant2::get<error_type>(_data);
85 return boost::variant2::get<value_type>(_data);
90 return boost::variant2::get<value_type>(_data);
93 operator bool()
const {
97 MSGPACK_DEFINE_ARRAY(_data)
101 boost::variant2::variant<error_type, value_type>
_data;
113 return success_flag{};
121 return _data.has_value();
124 template <
typename... Ts>
126 _data =
error_type(std::forward<Ts>(args)...);
134 operator bool()
const {
138 MSGPACK_DEFINE_ARRAY(_data)
142 struct success_flag {};
void SetError(Ts &&... args)
void Reset(TValue &&value)
Response(ResponseError error)
boost::variant2::variant< error_type, value_type > _data
boost::optional< error_type > _data
This file contains definitions of common data structures used in traffic manager. ...
#define DEBUG_ASSERT(predicate)
void SetError(Ts &&... args)
const std::string & What() const
const value_type & Get() const
const error_type & GetError() const
static Response Success()
ResponseError(std::string message)
const error_type & GetError() const