Merge branch 'develop' into feature/constexpr

This commit is contained in:
Peter Dimov
2018-01-22 21:13:37 +02:00
2 changed files with 24 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
// Copyright Beman Dawes 2006, 2007 // Copyright Beman Dawes 2006, 2007
// Copyright Christoper Kohlhoff 2007 // Copyright Christoper Kohlhoff 2007
// Copyright Peter Dimov 2017, 2018
// Distributed under the Boost Software License, Version 1.0. (See accompanying // Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -541,6 +542,15 @@ inline const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT
BOOST_SYSTEM_CONSTEXPR const error_category & category() const BOOST_SYSTEM_NOEXCEPT { return *m_cat; } BOOST_SYSTEM_CONSTEXPR const error_category & category() const BOOST_SYSTEM_NOEXCEPT { return *m_cat; }
std::string message() const { return m_cat->message(value()); } std::string message() const { return m_cat->message(value()); }
#if !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
explicit operator bool() const BOOST_SYSTEM_NOEXCEPT // true if error
{
return m_val != 0;
}
#else
typedef void (*unspecified_bool_type)(); typedef void (*unspecified_bool_type)();
static void unspecified_bool_true() {} static void unspecified_bool_true() {}
@@ -554,6 +564,8 @@ inline const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT
return m_val == 0; return m_val == 0;
} }
#endif
// relationals: // relationals:
// the more symmetrical non-member syntax allows enum // the more symmetrical non-member syntax allows enum
// conversions work for both rhs and lhs. // conversions work for both rhs and lhs.
@@ -640,6 +652,15 @@ inline const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT
{ return m_cat->default_error_condition(value()); } { return m_cat->default_error_condition(value()); }
std::string message() const { return m_cat->message(value()); } std::string message() const { return m_cat->message(value()); }
#if !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
explicit operator bool() const BOOST_SYSTEM_NOEXCEPT // true if error
{
return m_val != 0;
}
#else
typedef void (*unspecified_bool_type)(); typedef void (*unspecified_bool_type)();
static void unspecified_bool_true() {} static void unspecified_bool_true() {}
@@ -653,6 +674,8 @@ inline const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT
return m_val == 0; return m_val == 0;
} }
#endif
// relationals: // relationals:
BOOST_SYSTEM_CONSTEXPR inline friend bool operator==( const error_code & lhs, BOOST_SYSTEM_CONSTEXPR inline friend bool operator==( const error_code & lhs,
const error_code & rhs ) BOOST_SYSTEM_NOEXCEPT const error_code & rhs ) BOOST_SYSTEM_NOEXCEPT

View File

@@ -30,7 +30,7 @@ int main()
BOOST_TEST( bt.equivalent( ev, bn ) ); BOOST_TEST( bt.equivalent( ev, bn ) );
BOOST_TEST_EQ( bc, bn ); BOOST_TEST( bc == bn );
return boost::report_errors(); return boost::report_errors();
} }