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 UUID_7E48761AD92811DC9011477D56D89593
7 #define UUID_7E48761AD92811DC9011477D56D89593
9 #include <boost/utility/enable_if.hpp>
10 #include <boost/exception/detail/is_output_streamable.hpp>
20 typename disable_if
<is_output_streamable
<T
>,char>::type
to_string( T
const & );
22 template <class,bool IsOutputStreamable
>
23 struct has_to_string_impl
;
27 has_to_string_impl
<T
,true>
34 has_to_string_impl
<T
,false>
37 enum e
{ value
=1!=sizeof(to_string(f())) };
43 typename enable_if
<is_output_streamable
<T
>,std::string
>::type
44 to_string( T
const & x
)
46 std::ostringstream out
;
55 enum e
{ value
=to_string_detail::has_to_string_impl
<T
,is_output_streamable
<T
>::value
>::value
};
58 template <class T
,class U
>
61 to_string( std::pair
<T
,U
> const & x
)
63 return std::string("(") + to_string(x
.first
) + ',' + to_string(x
.second
) + ')';
68 to_string( std::exception
const & x
)