id summary reporter owner description type status milestone component version severity resolution keywords cc 5357 system::error_code::operator unspecified_bool_type() should not assume 0 == success. mgruenke@… Beman Dawes "[The following was submitted for discussion to boost@lists.boost.org on 2011-03-10. It received only one response, which was supportive.] I've found boost.system to be very useful for wrapping return codes from 3rd party libraries (e.g. libcurl). However, one problem I've encountered is that error_code's operator for boolean tests assumes that an error value of 0 == success. While this is often true, it is not universally so and precludes use of boost.system for such tasks as wrapping HTTP status codes (several of which are merely informative and don't indicate an error). I've found it puzzling that the logic for determining whether an error value represents an error doesn't reside in the error_category, where it can be customized as needed. For instance, boolean tests could chain to a is_error() virtual method in the error_category, the default implementation of which preserves the current behavior: {{{#!C++ namespace boost { namespace system { class error_category : public noncopyable { public: // ... virtual bool is_error( int ev ) const { return ev != 0; } // ... }; class error_code { public: // ... operator unspecified_bool_type() const { return m_cat->is_error( m_val ) ? unspecified_bool_true : 0; } // ... }; } } }}}" Feature Requests new To Be Determined system Boost 1.45.0 Problem viboes