Boost logo

Boost-Commit :

From: jefffaust_at_[hidden]
Date: 2007-05-28 19:25:53


Author: jefffaust
Date: 2007-05-28 19:25:52 EDT (Mon, 28 May 2007)
New Revision: 4341
URL: http://svn.boost.org/trac/boost/changeset/4341

Log:
Use is_assoc_iter to choose correct output function for map values.

Text files modified:
   sandbox/explore/boost/explore/stream_container.hpp | 30 ++++++++++++++++--------------
   1 files changed, 16 insertions(+), 14 deletions(-)

Modified: sandbox/explore/boost/explore/stream_container.hpp
==============================================================================
--- sandbox/explore/boost/explore/stream_container.hpp (original)
+++ sandbox/explore/boost/explore/stream_container.hpp 2007-05-28 19:25:52 EDT (Mon, 28 May 2007)
@@ -11,6 +11,7 @@
 #define STREAM_CONTAINER_INCLUDED
 
 #include "stream_state.hpp"
+#include "is_assoc_iter.hpp"
 
 #include <ostream>
 #include <boost/functional/detail/container_fwd.hpp>
@@ -187,6 +188,7 @@
     {
         iterator_range_wrapper(const boost::iterator_range<T>& ir) : t(ir) {}
         boost::iterator_range<T> t;
+ typedef typename boost::mpl::if_<typename is_assoc_iter<T>::type, stream_map_value, stream_normal_value>::type stream_type;
     };
 
     template<typename T>
@@ -197,15 +199,15 @@
 
     template< typename IteratorT >
     iterator_range_wrapper<IteratorT>
- make_iterator_range( IteratorT Begin, IteratorT End )
- {
+ make_iterator_range(IteratorT Begin, IteratorT End)
+ {
         return as_container(boost::make_iterator_range(Begin, End));
     }
 
     template< class ForwardRange >
     iterator_range_wrapper<BOOST_DEDUCED_TYPENAME boost::range_const_iterator<ForwardRange>::type>
- make_iterator_range( const ForwardRange& r )
- {
+ make_iterator_range(const ForwardRange& r)
+ {
         return as_container(boost::make_iterator_range(r));
     }
 }
@@ -276,25 +278,25 @@
 namespace explore
 {
 # if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
- template<typename Elem, typename Tr, typename T, std::size_t size>
- std::basic_ostream<Elem, Tr>& operator<<(std::basic_ostream<Elem, Tr>& ostr, T (&a)[size])
- {
- return stream_container(ostr, &a[0], &a[size]);
+ template<typename Elem, typename Tr, typename T, std::size_t size>
+ std::basic_ostream<Elem, Tr>& operator<<(std::basic_ostream<Elem, Tr>& ostr, T (&a)[size])
+ {
+ return stream_container(ostr, &a[0], &a[size]);
     }
 
- template<typename Elem, typename Tr, std::size_t size>
- std::basic_ostream<Elem, Tr>& operator<<(std::basic_ostream<Elem, Tr>& ostr, const Elem* s)
- {
- return stream_container(ostr, &s[0], &s[strlen(s)]);
+ template<typename Elem, typename Tr, std::size_t size>
+ std::basic_ostream<Elem, Tr>& operator<<(std::basic_ostream<Elem, Tr>& ostr, const Elem* s)
+ {
+ return stream_container(ostr, &s[0], &s[strlen(s)]);
     }
 # endif
 
     // stream boost::iterator_range
     template<typename Elem, typename Tr, typename T>
     std::basic_ostream<Elem, Tr>& operator<<(std::basic_ostream<Elem, Tr>& ostr,
- explore::iterator_range_wrapper<T>& r)
+ explore::iterator_range_wrapper<T>& r)
     {
- return explore::stream_container(ostr, r.t.begin(), r.t.end());
+ return explore::stream_container(ostr, r.t.begin(), r.t.end(), explore::iterator_range_wrapper<T>::stream_type());
     }
 
     // manipulator


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