() >> detail::lvalueref()))
inline std::istream &operator>>(std::istream &s, outcome &v)
{
s >> v._iostreams_state();
if(v.has_error())
{
s >> v.assume_error();
}
if(v.has_exception())
{
s >> v.assume_exception();
}
return s;
}
/*! AWAITING HUGO JSON CONVERSION TOOL
SIGNATURE NOT RECOGNISED
*/
BOOST_OUTCOME_TEMPLATE(class R, class S, class P, class N)
BOOST_OUTCOME_TREQUIRES(BOOST_OUTCOME_TEXPR(detail::lvalueref() << detail::lvalueref()), BOOST_OUTCOME_TEXPR(detail::lvalueref() << detail::lvalueref()), BOOST_OUTCOME_TEXPR(detail::lvalueref() << detail::lvalueref()))
inline std::ostream &operator<<(std::ostream &s, const outcome &v)
{
s << v._iostreams_state();
if(v.has_error())
{
s << v.assume_error();
}
if(v.has_exception())
{
s << v.assume_exception();
}
return s;
}
/*! AWAITING HUGO JSON CONVERSION TOOL
SIGNATURE NOT RECOGNISED
*/
template inline std::string print(const outcome &v)
{
std::stringstream s;
int total = static_cast(v.has_value()) + static_cast(v.has_error()) + static_cast(v.has_exception());
if(total > 1)
{
s << "{ ";
}
s << print(static_cast &>(static_cast &>(v))); // NOLINT
if(total > 1)
{
s << ", ";
}
if(v.has_exception())
{
#ifndef BOOST_NO_EXCEPTIONS
try
{
rethrow_exception(v.exception());
}
catch(const std::system_error &e)
{
s << "std::system_error code " << e.code() << ": " << e.what();
}
catch(const std::exception &e)
{
s << "std::exception: " << e.what();
}
catch(...)
#endif
{
s << "unknown exception";
}
}
if(total > 1)
{
s << " }";
}
return s.str();
}
BOOST_OUTCOME_V2_NAMESPACE_END
#endif