From fef97412e2ca84cdae43a12de278f513eea1a2f5 Mon Sep 17 00:00:00 2001 From: Jonathan Turkanis Date: Sun, 6 Feb 2005 22:08:42 +0000 Subject: [PATCH] simplified definition of io_category [SVN r27191] --- include/boost/iostreams/traits.hpp | 58 +++++++++--------------------- 1 file changed, 17 insertions(+), 41 deletions(-) diff --git a/include/boost/iostreams/traits.hpp b/include/boost/iostreams/traits.hpp index cda527c..0e0dce4 100755 --- a/include/boost/iostreams/traits.hpp +++ b/include/boost/iostreams/traits.hpp @@ -57,7 +57,7 @@ struct is_std_io namespace detail { template -struct get_char_type { typedef typename T::char_type type; }; +struct member_char_type { typedef typename T::char_type type; }; } // End namespace detail. @@ -65,7 +65,7 @@ struct get_char_type { typedef typename T::char_type type; }; template struct io_char - : detail::get_char_type< + : detail::member_char_type< typename detail::unwrapped_type::type > { }; @@ -87,7 +87,7 @@ struct io_char { mpl::eval_if< is_iterator_range, get_value_type, - detail::get_char_type< + detail::member_char_type< BOOST_DEDUCED_TYPENAME detail::unwrapped_type::type > >::type type; @@ -104,50 +104,26 @@ struct member_io_category { typedef typename T::io_category type; }; } // End namespace detail. -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION //---------------------------// - -template -struct io_category { - typedef typename - select< - is_iostream, iostream_tag, - is_istream, istream_tag, - is_ostream, ostream_tag, - is_streambuf, streambuf_tag, - is_stringstream, stringstream_tag, - is_stringbuf, stringbuf_tag, - mpl::true_, lazy< detail::member_io_category > - >::type type; -}; - -template -struct io_category< boost::reference_wrapper > - : io_category - { }; -template -struct io_category< const boost::reference_wrapper > - : io_category - { }; - -#else // #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION //------------------// - template struct io_category { + template + struct member_io_category { + typedef typename U::io_category type; + }; typedef typename detail::unwrapped_type::type U; typedef typename - select< - is_iostream, iostream_tag, - is_istream, istream_tag, - is_ostream, ostream_tag, - is_streambuf, streambuf_tag, - is_stringstream, stringstream_tag, - is_stringbuf, stringbuf_tag, - mpl::true_, lazy< detail::member_io_category > - >::type type; + mpl::eval_if< + is_std_io, + select< + is_iostream, iostream_tag, + is_istream, istream_tag, + is_ostream, ostream_tag, + is_streambuf, streambuf_tag + >, + detail::member_io_category + >::type type; }; -#endif // #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION //-----------------// - //------------------Definition of get_category--------------------------------// //