Allow printing an empty tuple

[SVN r53211]
This commit is contained in:
Steven Watanabe
2009-05-23 16:39:13 +00:00
parent 70e04d2965
commit 08277fd057
2 changed files with 53 additions and 5 deletions

View File

@ -285,6 +285,21 @@ print(std::basic_ostream<CharType, CharTrait>& o, const cons<T1, T2>& t) {
} // namespace detail
#if defined (BOOST_NO_TEMPLATED_STREAMS)
inline std::ostream& operator<<(std::ostream& o, const null_type& t) {
if (!o.good() ) return o;
const char l =
detail::format_info::get_manipulator(o, detail::format_info::open);
const char r =
detail::format_info::get_manipulator(o, detail::format_info::close);
o << l;
o << r;
return o;
}
template<class T1, class T2>
inline std::ostream& operator<<(std::ostream& o, const cons<T1, T2>& t) {
if (!o.good() ) return o;
@ -305,6 +320,23 @@ inline std::ostream& operator<<(std::ostream& o, const cons<T1, T2>& t) {
#else
template<class CharType, class CharTrait>
inline std::basic_ostream<CharType, CharTrait>&
operator<<(std::basic_ostream<CharType, CharTrait>& o,
const null_type& t) {
if (!o.good() ) return o;
const CharType l =
detail::format_info::get_manipulator(o, detail::format_info::open);
const CharType r =
detail::format_info::get_manipulator(o, detail::format_info::close);
o << l;
o << r;
return o;
}
template<class CharType, class CharTrait, class T1, class T2>
inline std::basic_ostream<CharType, CharTrait>&
operator<<(std::basic_ostream<CharType, CharTrait>& o,