mirror of
https://github.com/boostorg/exception.git
synced 2025-07-13 04:26:44 +02:00
removed tabs. what's wrong with tabs anyway?
[SVN r44246]
This commit is contained in:
@ -11,40 +11,40 @@
|
|||||||
namespace
|
namespace
|
||||||
boost
|
boost
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
to_string_detail
|
to_string_detail
|
||||||
{
|
{
|
||||||
template <bool>
|
template <bool>
|
||||||
struct
|
struct
|
||||||
is_output_streamable_dispatch
|
is_output_streamable_dispatch
|
||||||
{
|
{
|
||||||
enum e { value=1 };
|
enum e { value=1 };
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct
|
struct
|
||||||
is_output_streamable_dispatch<false>
|
is_output_streamable_dispatch<false>
|
||||||
{
|
{
|
||||||
enum e { value=0 };
|
enum e { value=0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T,class CharT,class Traits>
|
template <class T,class CharT,class Traits>
|
||||||
char operator<<( std::basic_ostream<CharT,Traits> &, T const & );
|
char operator<<( std::basic_ostream<CharT,Traits> &, T const & );
|
||||||
|
|
||||||
template <class T,class CharT,class Traits>
|
template <class T,class CharT,class Traits>
|
||||||
struct
|
struct
|
||||||
is_output_streamable_impl
|
is_output_streamable_impl
|
||||||
{
|
{
|
||||||
enum e { value=is_output_streamable_dispatch<1!=sizeof((*(std::basic_ostream<CharT,Traits>*)0)<<(*(T*)0))>::value };
|
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
|
struct
|
||||||
is_output_streamable
|
is_output_streamable
|
||||||
{
|
{
|
||||||
enum e { value=to_string_detail::is_output_streamable_impl<T,CharT,Traits>::value };
|
enum e { value=to_string_detail::is_output_streamable_impl<T,CharT,Traits>::value };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,45 +13,45 @@
|
|||||||
namespace
|
namespace
|
||||||
boost
|
boost
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
to_string_detail
|
to_string_detail
|
||||||
{
|
{
|
||||||
template <class T>
|
template <class T>
|
||||||
typename disable_if<is_output_streamable<T>,char>::type to_string( T const & );
|
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;
|
struct has_to_string_impl;
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct
|
struct
|
||||||
has_to_string_impl<T,true>
|
has_to_string_impl<T,true>
|
||||||
{
|
{
|
||||||
enum e { value=1 };
|
enum e { value=1 };
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct
|
struct
|
||||||
has_to_string_impl<T,false>
|
has_to_string_impl<T,false>
|
||||||
{
|
{
|
||||||
enum e { value=1!=sizeof(to_string(*(T*)0)) };
|
enum e { value=1!=sizeof(to_string(*(T*)0)) };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
typename enable_if<is_output_streamable<T>,std::string>::type
|
typename enable_if<is_output_streamable<T>,std::string>::type
|
||||||
to_string( T const & x )
|
to_string( T const & x )
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << x;
|
out << x;
|
||||||
return out.str();
|
return out.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct
|
struct
|
||||||
has_to_string
|
has_to_string
|
||||||
{
|
{
|
||||||
enum e { value=to_string_detail::has_to_string_impl<T,is_output_streamable<T>::value>::value };
|
enum e { value=to_string_detail::has_to_string_impl<T,is_output_streamable<T>::value>::value };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,7 +35,7 @@ boost
|
|||||||
{
|
{
|
||||||
template <class T,class Stub>
|
template <class T,class Stub>
|
||||||
static
|
static
|
||||||
std::string
|
std::string
|
||||||
convert( T const & x, Stub s )
|
convert( T const & x, Stub s )
|
||||||
{
|
{
|
||||||
return s(x);
|
return s(x);
|
||||||
@ -49,7 +49,7 @@ boost
|
|||||||
std::string
|
std::string
|
||||||
dispatch( T const & x, Stub s )
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ n2
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
to_string( c2 const & )
|
to_string( c2 const & )
|
||||||
{
|
{
|
||||||
return "c2";
|
return "c2";
|
||||||
@ -38,8 +38,8 @@ n3
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream &
|
std::ostream &
|
||||||
operator<<( std::ostream & s, c3 const & )
|
operator<<( std::ostream & s, c3 const & )
|
||||||
{
|
{
|
||||||
return s << "c3";
|
return s << "c3";
|
||||||
}
|
}
|
||||||
@ -48,10 +48,10 @@ n3
|
|||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
using namespace boost;
|
using namespace boost;
|
||||||
BOOST_TEST( !has_to_string<n1::c1>::value );
|
BOOST_TEST( !has_to_string<n1::c1>::value );
|
||||||
BOOST_TEST( has_to_string<n2::c2>::value );
|
BOOST_TEST( has_to_string<n2::c2>::value );
|
||||||
BOOST_TEST( has_to_string<n3::c3>::value );
|
BOOST_TEST( has_to_string<n3::c3>::value );
|
||||||
BOOST_TEST( has_to_string<int>::value );
|
BOOST_TEST( has_to_string<int>::value );
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@ n2
|
|||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
BOOST_TEST( !boost::is_output_streamable<n1::c1>::value );
|
BOOST_TEST( !boost::is_output_streamable<n1::c1>::value );
|
||||||
BOOST_TEST( boost::is_output_streamable<n2::c2>::value );
|
BOOST_TEST( boost::is_output_streamable<n2::c2>::value );
|
||||||
BOOST_TEST( boost::is_output_streamable<int>::value );
|
BOOST_TEST( boost::is_output_streamable<int>::value );
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ n1
|
|||||||
int
|
int
|
||||||
tester()
|
tester()
|
||||||
{
|
{
|
||||||
using namespace boost;
|
using namespace boost;
|
||||||
(void) to_string(n1::c1());
|
(void) to_string(n1::c1());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ n2
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
to_string( c2 const & )
|
to_string( c2 const & )
|
||||||
{
|
{
|
||||||
return "c2";
|
return "c2";
|
||||||
@ -38,8 +38,8 @@ n3
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream &
|
std::ostream &
|
||||||
operator<<( std::ostream & s, c3 const & )
|
operator<<( std::ostream & s, c3 const & )
|
||||||
{
|
{
|
||||||
return s << "c3";
|
return s << "c3";
|
||||||
}
|
}
|
||||||
@ -48,9 +48,9 @@ n3
|
|||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
using namespace boost;
|
using namespace boost;
|
||||||
BOOST_TEST( "c2"==to_string(n2::c2()) );
|
BOOST_TEST( "c2"==to_string(n2::c2()) );
|
||||||
BOOST_TEST( "c3"==to_string(n3::c3()) );
|
BOOST_TEST( "c3"==to_string(n3::c3()) );
|
||||||
BOOST_TEST( "42"==to_string(42) );
|
BOOST_TEST( "42"==to_string(42) );
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user