1 //Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
\r
3 //Distributed under the Boost Software License, Version 1.0. (See accompanying
\r
4 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
\r
6 #ifndef UUID_7E48761AD92811DC9011477D56D89593
\r
7 #define UUID_7E48761AD92811DC9011477D56D89593
\r
8 #if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
\r
9 #pragma GCC system_header
\r
11 #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
\r
12 #pragma warning(push,1)
\r
15 #include <boost/utility/enable_if.hpp>
\r
16 #include <boost/exception/detail/is_output_streamable.hpp>
\r
26 typename disable_if<is_output_streamable<T>,char>::type to_string( T const & );
\r
28 template <class,bool IsOutputStreamable>
\r
29 struct has_to_string_impl;
\r
33 has_to_string_impl<T,true>
\r
40 has_to_string_impl<T,false>
\r
42 static T const & f();
\r
43 enum e { value=1!=sizeof(to_string(f())) };
\r
49 typename enable_if<is_output_streamable<T>,std::string>::type
\r
50 to_string( T const & x )
\r
52 std::ostringstream out;
\r
61 enum e { value=to_string_detail::has_to_string_impl<T,is_output_streamable<T>::value>::value };
\r
64 template <class T,class U>
\r
67 to_string( std::pair<T,U> const & x )
\r
69 return std::string("(") + to_string(x.first) + ',' + to_string(x.second) + ')';
\r
74 to_string( std::exception const & x )
\r
80 #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
\r
81 #pragma warning(pop)
\r