forked from boostorg/throw_exception
Both enable_error_info.hpp and enable_current_exception.hpp now do not depend on intrusive_ptr or any other Boost lib.
[SVN r48482]
This commit is contained in:
committed by
Peter Dimov
parent
95b0ce06a5
commit
ef9efac658
@ -7,7 +7,7 @@
|
|||||||
#define UUID_274DA366004E11DCB1DDFE2E56D89593
|
#define UUID_274DA366004E11DCB1DDFE2E56D89593
|
||||||
|
|
||||||
#include <boost/exception/detail/counted_base.hpp>
|
#include <boost/exception/detail/counted_base.hpp>
|
||||||
#include <boost/intrusive_ptr.hpp>
|
#include <boost/exception/detail/refcount_ptr.hpp>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
boost
|
boost
|
||||||
@ -61,28 +61,16 @@ boost
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1500) )
|
|
||||||
//Force class exception to be abstract.
|
|
||||||
//Otherwise, MSVC bug allows throw exception(), even though the copy constructor is protected.
|
|
||||||
virtual ~exception() throw()=0;
|
virtual ~exception() throw()=0;
|
||||||
#else
|
|
||||||
#if BOOST_WORKAROUND( __GNUC__, BOOST_TESTED_AT(4) )
|
|
||||||
virtual //Disable bogus GCC warning.
|
|
||||||
#endif
|
|
||||||
~exception() throw()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char const *
|
char const *
|
||||||
_diagnostic_information() const throw()
|
_diagnostic_information() const throw()
|
||||||
{
|
{
|
||||||
if( data_ )
|
if( exception_detail::error_info_container * c=data_.get() )
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
char const * w = data_->diagnostic_information();
|
if( char const * w = c->diagnostic_information() )
|
||||||
BOOST_ASSERT(w!=0);
|
return w;
|
||||||
return w;
|
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
@ -97,16 +85,14 @@ boost
|
|||||||
template <class ErrorInfo>
|
template <class ErrorInfo>
|
||||||
friend shared_ptr<typename ErrorInfo::value_type const> exception_detail::get_data( exception const & );
|
friend shared_ptr<typename ErrorInfo::value_type const> exception_detail::get_data( exception const & );
|
||||||
|
|
||||||
mutable intrusive_ptr<exception_detail::error_info_container> data_;
|
mutable exception_detail::refcount_ptr<exception_detail::error_info_container> data_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1500) ) //See above.
|
|
||||||
inline
|
inline
|
||||||
exception::
|
exception::
|
||||||
~exception() throw()
|
~exception() throw()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user