Boost logo

Boost-Commit :

From: technews_at_[hidden]
Date: 2008-05-27 19:23:57


Author: turkanis
Date: 2008-05-27 19:23:57 EDT (Tue, 27 May 2008)
New Revision: 45837
URL: http://svn.boost.org/trac/boost/changeset/45837

Log:
added partial specializations of category_of and mode_of for reference wrappers; allows ref(c) to be treated as a filter or device if c is a filter or device
Text files modified:
   trunk/boost/iostreams/traits.hpp | 23 ++++++++++++++++++++++-
   1 files changed, 22 insertions(+), 1 deletions(-)

Modified: trunk/boost/iostreams/traits.hpp
==============================================================================
--- trunk/boost/iostreams/traits.hpp (original)
+++ trunk/boost/iostreams/traits.hpp 2008-05-27 19:23:57 EDT (Tue, 27 May 2008)
@@ -39,6 +39,7 @@
 # include <boost/range/iterator_range.hpp>
 # include <boost/range/value_type.hpp>
 #endif // #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+#include <boost/ref.hpp>
 #include <boost/type_traits/is_convertible.hpp>
 
 namespace boost { namespace iostreams {
@@ -279,6 +280,16 @@
>::type type;
 };
 
+// Partial specialization for reference wrappers
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION //---------------------------//
+
+template<typename T>
+struct category_of< reference_wrapper<T> >
+ : category_of<T>
+ { };
+
+#endif // #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION //-----------------//
+
 //------------------Definition of get_category--------------------------------//
 
 //
@@ -302,7 +313,7 @@
 #endif
 };
 
-//------------------Definition of mode----------------------------------------//
+//------------------Definition of mode_of-------------------------------------//
 
 namespace detail {
 
@@ -333,6 +344,16 @@
 
 template<typename T> // Borland 5.6.4 requires this circumlocution.
 struct mode_of : detail::io_mode_impl< detail::io_mode_id<T>::value > { };
+
+// Partial specialization for reference wrappers
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION //---------------------------//
+
+template<typename T>
+struct mode_of< reference_wrapper<T> >
+ : mode_of<T>
+ { };
+
+#endif // #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION //-----------------//
                     
 //------------------Definition of is_device, is_filter and is_direct----------//
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk