0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-11 14:38:57 +02:00

ircd: Add suite for equating std::system_category() with boost::system.

This commit is contained in:
Jason Volk 2018-11-08 21:04:07 -08:00
parent cfcbbad0c0
commit 4c85f11a02
2 changed files with 32 additions and 0 deletions

View file

@ -15,6 +15,7 @@
namespace boost::system
{
struct error_code;
struct error_category;
struct system_error;
namespace errc {}
}
@ -39,6 +40,11 @@ namespace ircd
template<class... args> std::exception_ptr make_system_eptr(args&&...);
template<class... args> [[noreturn]] void throw_system_error(args&&...);
bool system_category(const std::error_category &);
bool system_category(const std::error_code &);
bool system_category(const boost::system::error_category &);
bool system_category(const boost::system::error_code &);
string_view string(const mutable_buffer &, const std::error_code &);
string_view string(const mutable_buffer &, const std::system_error &);
string_view string(const mutable_buffer &, const boost::system::error_code &);

View file

@ -87,6 +87,32 @@ ircd::string(const mutable_buffer &buf,
};
}
bool
ircd::system_category(const boost::system::error_code &ec)
{
return system_category(ec.category());
}
bool
ircd::system_category(const boost::system::error_category &ec)
{
return ec == boost::system::system_category();
}
bool
ircd::system_category(const std::error_code &ec)
{
return system_category(ec.category());
}
bool
ircd::system_category(const std::error_category &ec)
{
return ec == std::system_category() ||
ec == std::generic_category() ||
ec == boost::system::system_category();
}
std::system_error
ircd::make_system_error(const boost::system::system_error &e)
{