Ticket #7347: 7347.patch

File 7347.patch, 4.6 KB (added by viboes, 10 years ago)

Simple patch that solves my issue. OK to commit?

  • error_code.hpp

     
    2323#include <functional>
    2424
    2525// TODO: undef these macros if not already defined
    26 #include <boost/cerrno.hpp> 
     26#include <boost/cerrno.hpp>
    2727
    2828#if !defined(BOOST_POSIX_API) && !defined(BOOST_WINDOWS_API)
    2929#  error BOOST_POSIX_API or BOOST_WINDOWS_API must be defined
     
    187187      virtual const char *     name() const = 0;
    188188      virtual std::string      message( int ev ) const = 0;
    189189      virtual error_condition  default_error_condition( int ev ) const;
    190       virtual bool             equivalent( int code, 
     190      virtual bool             equivalent( int code,
    191191                                           const error_condition & condition ) const;
    192192      virtual bool             equivalent( const error_code & code,
    193193                                           int condition ) const;
     
    202202
    203203    //  predefined error categories  -----------------------------------------//
    204204
     205# ifdef BOOST_ERROR_CODE_HEADER_ONLY
     206    inline const error_category &  system_category();
     207    inline const error_category &  generic_category();
     208#else
    205209    BOOST_SYSTEM_DECL const error_category &  system_category();
    206210    BOOST_SYSTEM_DECL const error_category &  generic_category();
    207 
     211#endif
    208212    //  deprecated synonyms --------------------------------------------------//
    209213
    210214# ifndef BOOST_SYSTEM_NO_DEPRECATED
     
    238242      // modifiers:
    239243
    240244      void assign( int val, const error_category & cat )
    241       { 
     245      {
    242246        m_val = val;
    243247        m_cat = &cat;
    244248      }
    245                                              
     249
    246250      template<typename ErrorConditionEnum>
    247251        typename boost::enable_if<is_error_condition_enum<ErrorConditionEnum>, error_condition>::type &
    248252          operator=( ErrorConditionEnum val )
    249       { 
     253      {
    250254        *this = make_error_condition(val);
    251255        return *this;
    252256      }
     
    266270      static void unspecified_bool_true() {}
    267271
    268272      operator unspecified_bool_type() const  // true if error
    269       { 
     273      {
    270274        return m_val == 0 ? 0 : unspecified_bool_true;
    271275      }
    272276
     
    282286                                     const error_condition & rhs )
    283287      {
    284288        return lhs.m_cat == rhs.m_cat && lhs.m_val == rhs.m_val;
    285       }                 
     289      }
    286290
    287291      inline friend bool operator<( const error_condition & lhs,
    288292                                    const error_condition & rhs )
     
    324328
    325329      // modifiers:
    326330      void assign( int val, const error_category & cat )
    327       { 
     331      {
    328332        m_val = val;
    329333        m_cat = &cat;
    330334      }
    331                                              
     335
    332336      template<typename ErrorCodeEnum>
    333337        typename boost::enable_if<is_error_code_enum<ErrorCodeEnum>, error_code>::type &
    334338          operator=( ErrorCodeEnum val )
    335       { 
     339      {
    336340        *this = make_error_code(val);
    337341        return *this;
    338342      }
     
    353357      static void unspecified_bool_true() {}
    354358
    355359      operator unspecified_bool_type() const  // true if error
    356       { 
     360      {
    357361        return m_val == 0 ? 0 : unspecified_bool_true;
    358362      }
    359363
     
    379383        return lhs.m_cat < rhs.m_cat
    380384          || (lhs.m_cat == rhs.m_cat && lhs.m_val < rhs.m_val);
    381385      }
    382                  
     386
    383387      private:
    384388      int                     m_val;
    385389      const error_category *  m_cat;
     
    431435      return code.category().equivalent( code.value(), condition )
    432436        || condition.category().equivalent( code, condition.value() );
    433437    }
    434                
     438
    435439    inline bool operator!=( const error_code & lhs,
    436440                            const error_condition & rhs )
    437441    {
    438442      return !(lhs == rhs);
    439443    }
    440                
     444
    441445    inline bool operator==( const error_condition & condition,
    442446                            const error_code & code )
    443447    {
    444448      return condition.category().equivalent( code, condition.value() )
    445449        || code.category().equivalent( code.value(), condition );
    446450    }
    447                
     451
    448452    inline bool operator!=( const error_condition & lhs,
    449453                            const error_code & rhs )
    450454    {
    451455      return !(lhs == rhs);
    452456    }
    453                  
     457
    454458    // TODO: both of these may move elsewhere, but the LWG hasn't spoken yet.
    455459
    456460    template <class charT, class traits>
     
    483487    //  error_category default implementation  -------------------------------//
    484488
    485489    inline error_condition error_category::default_error_condition( int ev ) const
    486     { 
     490    {
    487491      return error_condition( ev, *this );
    488492    }
    489493