1 //Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc.
3 //Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #ifndef UUID_0C5D492E909711DCB658AD4556D89593
7 #define UUID_0C5D492E909711DCB658AD4556D89593
9 #include <boost/exception/exception.hpp>
10 #include <boost/detail/workaround.hpp>
11 #include <boost/config.hpp>
27 error_info_injector( T const & x ):
32 ~error_info_injector() throw()
37 diagnostic_information() const throw()
39 return boost::exception::_diagnostic_information(T::what());
43 struct large_size { char c[256]; };
44 large_size dispatch( exception * );
46 struct small_size { };
47 small_size dispatch( void * );
49 template <class,size_t>
50 struct enable_error_info_helper;
54 enable_error_info_helper<T,sizeof(large_size)>
61 enable_error_info_helper<T,sizeof(small_size)>
63 typedef error_info_injector<T> type;
66 #if BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x582))
71 BOOST_STATIC_CONSTANT(int, value = sizeof(dispatch((T*)0)) );
76 enable_error_info_return_type
78 typedef typename enable_error_info_helper<T,sizeof_dispatch<T>::value>::type type;
83 enable_error_info_return_type
85 typedef typename enable_error_info_helper<T,sizeof(dispatch((T*)0))>::type type;
92 #if !BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x582))
95 exception_detail::enable_error_info_return_type<T>::type
96 enable_error_info( T const & x )
99 #if !BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x582))
102 exception_detail::enable_error_info_return_type<T>::type(x);