1 //Copyright (c) 2006-2009 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 BOOST_EXCEPTION_7E48761AD92811DC9011477D56D89593
7 #define BOOST_EXCEPTION_7E48761AD92811DC9011477D56D89593
9 #include <boost/utility/enable_if.hpp>
10 #include <boost/exception/detail/is_output_streamable.hpp>
13 #ifndef BOOST_EXCEPTION_ENABLE_WARNINGS
14 #if __GNUC__*100+__GNUC_MINOR__>301
15 #pragma GCC system_header
18 #pragma clang system_header
21 #pragma warning(push,1)
28 template <class T,class U>
29 std::string to_string( std::pair<T,U> const & );
30 std::string to_string( std::exception const & );
36 typename disable_if<is_output_streamable<T>,char>::type to_string( T const & );
37 using boost::to_string;
39 template <class,bool IsOutputStreamable>
40 struct has_to_string_impl;
44 has_to_string_impl<T,true>
51 has_to_string_impl<T,false>
54 enum e { value=1!=sizeof(to_string(f())) };
60 typename enable_if<is_output_streamable<T>,std::string>::type
61 to_string( T const & x )
63 std::ostringstream out;
72 enum e { value=to_string_detail::has_to_string_impl<T,is_output_streamable<T>::value>::value };
75 template <class T,class U>
78 to_string( std::pair<T,U> const & x )
80 return std::string("(") + to_string(x.first) + ',' + to_string(x.second) + ')';
85 to_string( std::exception const & x )
91 #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)