Index: detail/error_info_impl.hpp =================================================================== --- detail/error_info_impl.hpp (revision 51549) +++ detail/error_info_impl.hpp (working copy) @@ -31,7 +31,7 @@ }; } - template + template class error_info: public exception_detail::error_info_base @@ -39,6 +39,7 @@ public: typedef T value_type; + typedef Base base_type; error_info( value_type const & value ); ~error_info() throw(); @@ -49,10 +50,11 @@ return value_; } + protected: + std::string value_as_string() const; + private: - char const * tag_typeid_name() const; - std::string value_as_string() const; value_type const value_; }; Index: error_info.hpp =================================================================== --- error_info.hpp (revision 51549) +++ error_info.hpp (working copy) @@ -3,4 +3,4 @@ //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) -namespace boost { template class error_info; } +namespace boost { template class error_info; } Index: exception.hpp =================================================================== --- exception.hpp (revision 51549) +++ exception.hpp (working copy) @@ -6,6 +6,8 @@ #ifndef UUID_274DA366004E11DCB1DDFE2E56D89593 #define UUID_274DA366004E11DCB1DDFE2E56D89593 +#include + namespace boost { @@ -77,57 +79,38 @@ //////////////////////////////////////////////////////////////////////// - template - class error_info; - - typedef error_info throw_function; - typedef error_info throw_file; - typedef error_info throw_line; - - template <> class - error_info + throw_function:public error_info { public: - typedef char const * value_type; - value_type v_; - explicit - error_info( value_type v ): - v_(v) + throw_function( char const * v ): + error_info (v) { } }; - template <> class - error_info + throw_file:public error_info { public: - typedef char const * value_type; - value_type v_; - explicit - error_info( value_type v ): - v_(v) + throw_file( char const * v ): + error_info (v) { } }; - template <> class - error_info + throw_line:public error_info { public: - typedef int value_type; - value_type v_; - explicit - error_info( value_type v ): - v_(v) + throw_line( int v ): + error_info (v) { } }; - template - E const & operator<<( E const &, error_info const & ); + template + E const & operator<<( E const &, error_info const & ); class exception; @@ -233,8 +216,8 @@ friend char const * exception_detail::get_diagnostic_information( exception const & ); - template - friend E const & operator<<( E const &, error_info const & ); + template + friend E const & operator<<( E const &, error_info const & ); template friend struct exception_detail::get_info; Index: info.hpp =================================================================== --- info.hpp (revision 51549) +++ info.hpp (working copy) @@ -15,42 +15,42 @@ namespace boost { - template + template inline typename enable_if,std::string>::type - to_string( error_info const & x ) + to_string( error_info const & x ) { return to_string(x.value()); } - template + template inline - error_info:: + error_info:: error_info( value_type const & value ): value_(value) { } - template + template inline - error_info:: + error_info:: ~error_info() throw() { } - template + template inline char const * - error_info:: + error_info:: tag_typeid_name() const { return tag_type_name(); } - template + template inline std::string - error_info:: + error_info:: value_as_string() const { return to_string_stub(*this); @@ -141,19 +141,20 @@ }; } - template + template inline E const & - operator<<( E const & x, error_info const & v ) + operator<<( E const & x, error_info const & v ) { - typedef error_info error_info_tag_t; - shared_ptr p( new error_info_tag_t(v) ); + typedef error_info error_info_tag_t; + shared_ptr p( new Base(v) ); exception_detail::error_info_container * c; if( !(c=x.data_.get()) ) x.data_.adopt(c=new exception_detail::error_info_container_impl); c->set(p,BOOST_EXCEPTION_STATIC_TYPEID(error_info_tag_t)); return x; } - } + } + #endif Index: info_tuple.hpp =================================================================== --- info_tuple.hpp (revision 51549) +++ info_tuple.hpp (working copy) @@ -14,51 +14,51 @@ { template < class E, - class Tag1,class T1, - class Tag2,class T2 > + class Tag1,class T1,class Base1, + class Tag2,class T2,class Base2 > inline E const & operator<<( E const & x, tuple< - error_info, - error_info > const & v ) + error_info, + error_info > const & v ) { return x << v.template get<0>() << v.template get<1>(); } template < class E, - class Tag1,class T1, - class Tag2,class T2, - class Tag3,class T3 > + class Tag1,class T1,class Base1, + class Tag2,class T2,class Base2, + class Tag3,class T3,class Base3 > inline E const & operator<<( E const & x, tuple< - error_info, - error_info, - error_info > const & v ) + error_info, + error_info, + error_info > const & v ) { return x << v.template get<0>() << v.template get<1>() << v.template get<2>(); } template < class E, - class Tag1,class T1, - class Tag2,class T2, - class Tag3,class T3, - class Tag4,class T4 > + class Tag1,class T1,class Base1, + class Tag2,class T2,class Base2, + class Tag3,class T3,class Base3, + class Tag4,class T4,class Base4 > inline E const & operator<<( E const & x, tuple< - error_info, - error_info, - error_info, - error_info > const & v ) + error_info, + error_info, + error_info, + error_info > const & v ) { return x << v.template get<0>() << v.template get<1>() << v.template get<2>() << v.template get<3>(); }