mirror of
				https://github.com/boostorg/system.git
				synced 2025-11-04 01:31:53 +01:00 
			
		
		
		
	Use explicit operator bool when available
This commit is contained in:
		@@ -2,6 +2,7 @@
 | 
			
		||||
 | 
			
		||||
//  Copyright Beman Dawes 2006, 2007
 | 
			
		||||
//  Copyright Christoper Kohlhoff 2007
 | 
			
		||||
//  Copyright Peter Dimov 2017, 2018
 | 
			
		||||
 | 
			
		||||
//  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)
 | 
			
		||||
@@ -387,6 +388,15 @@ namespace boost
 | 
			
		||||
      const error_category &  category() const BOOST_SYSTEM_NOEXCEPT { return *m_cat; }
 | 
			
		||||
      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)();
 | 
			
		||||
      static void unspecified_bool_true() {}
 | 
			
		||||
 | 
			
		||||
@@ -400,6 +410,8 @@ namespace boost
 | 
			
		||||
        return m_val == 0;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
      // relationals:
 | 
			
		||||
      //  the more symmetrical non-member syntax allows enum
 | 
			
		||||
      //  conversions work for both rhs and lhs.
 | 
			
		||||
@@ -486,6 +498,15 @@ namespace boost
 | 
			
		||||
        { return m_cat->default_error_condition(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)();
 | 
			
		||||
      static void unspecified_bool_true() {}
 | 
			
		||||
 | 
			
		||||
@@ -499,6 +520,8 @@ namespace boost
 | 
			
		||||
        return m_val == 0;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
      // relationals:
 | 
			
		||||
      inline friend bool operator==( const error_code & lhs,
 | 
			
		||||
                                     const error_code & rhs ) BOOST_SYSTEM_NOEXCEPT
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user