Boost logo

Boost-Commit :

From: bdawes_at_[hidden]
Date: 2007-09-08 11:20:04


Author: bemandawes
Date: 2007-09-08 11:19:54 EDT (Sat, 08 Sep 2007)
New Revision: 39167
URL: http://svn.boost.org/trac/boost/changeset/39167

Log:
error_category::operator< now uses std::less to ensure total order on pointers, per <functional> specs
Text files modified:
   branches/libs/system/boost/system/error_code.hpp | 9 ++++++---
   1 files changed, 6 insertions(+), 3 deletions(-)

Modified: branches/libs/system/boost/system/error_code.hpp
==============================================================================
--- branches/libs/system/boost/system/error_code.hpp (original)
+++ branches/libs/system/boost/system/error_code.hpp 2007-09-08 11:19:54 EDT (Sat, 08 Sep 2007)
@@ -19,8 +19,8 @@
 #include <boost/utility/enable_if.hpp>
 #include <ostream>
 #include <string>
-#include <cstring>
 #include <stdexcept>
+#include <functional>
 
 // TODO: undef these macros if not already defined
 #include <boost/cerrno.hpp>
@@ -153,8 +153,11 @@
       virtual bool equivalent( const error_code & code, int condition ) const;
 
       bool operator==(const error_category & rhs) const { return this == &rhs; }
- bool operator!=(const error_category & rhs) const { return !(*this == rhs); }
- bool operator<( const error_category & rhs ) const{ return std::strcmp(name(), rhs.name()) < 0; }
+ bool operator!=(const error_category & rhs) const { return this != &rhs; }
+ bool operator<( const error_category & rhs ) const
+ {
+ return std::less<const error_category*>()( this, &rhs );
+ }
     };
 
     // predefined error categories -----------------------------------------//


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk