Convert generic_category to std::generic_category

This commit is contained in:
Peter Dimov
2021-09-19 17:08:46 +03:00
parent 5fd2535d9f
commit b1dec88674
2 changed files with 7 additions and 7 deletions

View File

@ -102,18 +102,17 @@ inline char const * error_category::message( int ev, char * buffer, std::size_t
inline boost::system::error_category::operator std::error_category const & () const
{
if( id_ == boost::system::detail::generic_category_id )
{
return std::generic_category();
}
if( id_ == boost::system::detail::system_category_id )
{
static const boost::system::detail::std_category system_instance( this, 0x1F4D7 );
return system_instance;
}
if( id_ == boost::system::detail::generic_category_id )
{
static const boost::system::detail::std_category generic_instance( this, 0x1F4D3 );
return generic_instance;
}
boost::system::detail::std_category* p = ps_.load( std::memory_order_acquire );
if( p != 0 )

View File

@ -44,7 +44,8 @@ static void test_generic_category()
int ev = ENOENT;
BOOST_TEST_EQ( bt.message( ev ), st.message( ev ) );
// Under MSVC, it's "no such file or directory" instead of "No such file or directory"
BOOST_TEST_EQ( bt.message( ev ).substr( 1 ), st.message( ev ).substr( 1 ) );
{
boost::system::error_code bc( ev, bt );