forked from boostorg/exception
removed tabs. what's wrong with tabs anyway?
[SVN r44246]
This commit is contained in:
@ -11,40 +11,40 @@
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
to_string_detail
|
||||
{
|
||||
template <bool>
|
||||
struct
|
||||
is_output_streamable_dispatch
|
||||
{
|
||||
enum e { value=1 };
|
||||
};
|
||||
namespace
|
||||
to_string_detail
|
||||
{
|
||||
template <bool>
|
||||
struct
|
||||
is_output_streamable_dispatch
|
||||
{
|
||||
enum e { value=1 };
|
||||
};
|
||||
|
||||
template <>
|
||||
struct
|
||||
is_output_streamable_dispatch<false>
|
||||
{
|
||||
enum e { value=0 };
|
||||
};
|
||||
template <>
|
||||
struct
|
||||
is_output_streamable_dispatch<false>
|
||||
{
|
||||
enum e { value=0 };
|
||||
};
|
||||
|
||||
template <class T,class CharT,class Traits>
|
||||
char operator<<( std::basic_ostream<CharT,Traits> &, T const & );
|
||||
|
||||
template <class T,class CharT,class Traits>
|
||||
template <class T,class CharT,class Traits>
|
||||
struct
|
||||
is_output_streamable_impl
|
||||
{
|
||||
enum e { value=is_output_streamable_dispatch<1!=sizeof((*(std::basic_ostream<CharT,Traits>*)0)<<(*(T*)0))>::value };
|
||||
};
|
||||
}
|
||||
is_output_streamable_impl
|
||||
{
|
||||
enum e { value=is_output_streamable_dispatch<1!=sizeof((*(std::basic_ostream<CharT,Traits>*)0)<<(*(T*)0))>::value };
|
||||
};
|
||||
}
|
||||
|
||||
template <class T, class CharT=char, class Traits=std::char_traits<CharT> >
|
||||
template <class T, class CharT=char, class Traits=std::char_traits<CharT> >
|
||||
struct
|
||||
is_output_streamable
|
||||
{
|
||||
enum e { value=to_string_detail::is_output_streamable_impl<T,CharT,Traits>::value };
|
||||
};
|
||||
is_output_streamable
|
||||
{
|
||||
enum e { value=to_string_detail::is_output_streamable_impl<T,CharT,Traits>::value };
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -13,45 +13,45 @@
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
to_string_detail
|
||||
{
|
||||
namespace
|
||||
to_string_detail
|
||||
{
|
||||
template <class T>
|
||||
typename disable_if<is_output_streamable<T>,char>::type to_string( T const & );
|
||||
|
||||
template <class,bool IsOutputStreamable>
|
||||
template <class,bool IsOutputStreamable>
|
||||
struct has_to_string_impl;
|
||||
|
||||
template <class T>
|
||||
template <class T>
|
||||
struct
|
||||
has_to_string_impl<T,true>
|
||||
{
|
||||
enum e { value=1 };
|
||||
};
|
||||
has_to_string_impl<T,true>
|
||||
{
|
||||
enum e { value=1 };
|
||||
};
|
||||
|
||||
template <class T>
|
||||
template <class T>
|
||||
struct
|
||||
has_to_string_impl<T,false>
|
||||
{
|
||||
enum e { value=1!=sizeof(to_string(*(T*)0)) };
|
||||
};
|
||||
}
|
||||
has_to_string_impl<T,false>
|
||||
{
|
||||
enum e { value=1!=sizeof(to_string(*(T*)0)) };
|
||||
};
|
||||
}
|
||||
|
||||
template <class T>
|
||||
typename enable_if<is_output_streamable<T>,std::string>::type
|
||||
to_string( T const & x )
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << x;
|
||||
return out.str();
|
||||
}
|
||||
template <class T>
|
||||
typename enable_if<is_output_streamable<T>,std::string>::type
|
||||
to_string( T const & x )
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << x;
|
||||
return out.str();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <class T>
|
||||
struct
|
||||
has_to_string
|
||||
{
|
||||
enum e { value=to_string_detail::has_to_string_impl<T,is_output_streamable<T>::value>::value };
|
||||
};
|
||||
has_to_string
|
||||
{
|
||||
enum e { value=to_string_detail::has_to_string_impl<T,is_output_streamable<T>::value>::value };
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -35,7 +35,7 @@ boost
|
||||
{
|
||||
template <class T,class Stub>
|
||||
static
|
||||
std::string
|
||||
std::string
|
||||
convert( T const & x, Stub s )
|
||||
{
|
||||
return s(x);
|
||||
@ -49,7 +49,7 @@ boost
|
||||
std::string
|
||||
dispatch( T const & x, Stub s )
|
||||
{
|
||||
return to_string_dispatcher<has_to_string<T>::value>::convert(x,s);
|
||||
return to_string_dispatcher<has_to_string<T>::value>::convert(x,s);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user