Boost logo

Boost-Commit :

From: jared_at_[hidden]
Date: 2007-05-26 19:59:20


Author: jared
Date: 2007-05-26 19:59:19 EDT (Sat, 26 May 2007)
New Revision: 4295
URL: http://svn.boost.org/trac/boost/changeset/4295

Log:
print can now accept two iterators.

Text files modified:
   sandbox/explore/boost/explore/explore.hpp | 21 +++++++++++++++++++++
   1 files changed, 21 insertions(+), 0 deletions(-)

Modified: sandbox/explore/boost/explore/explore.hpp
==============================================================================
--- sandbox/explore/boost/explore/explore.hpp (original)
+++ sandbox/explore/boost/explore/explore.hpp 2007-05-26 19:59:19 EDT (Sat, 26 May 2007)
@@ -30,6 +30,7 @@
 #include <boost/utility/enable_if.hpp>
 #include <boost/foreach.hpp>
 #include <boost/range/iterator.hpp>
+#include <boost/range/iterator_range.hpp>
 
 namespace explore {
         using namespace boost::mpl;
@@ -349,6 +350,26 @@
         {
                 return print( item, stream, default_format(), default_container_policy());
         }
+
+ template< typename format_type,
+ typename container_policy_type ,
+ class InputIterator
+ >
+ std::ostream &print( InputIterator first,
+ InputIterator last,
+ std::ostream &stream,
+ const format_type &format,
+ const container_policy_type &policy)
+ {
+ return container_printer::print_item<format_type, container_policy_type>( boost::make_iterator_range(first, last), stream );
+ }
+
+ template<class InputIterator>
+ std::ostream &print(InputIterator first, InputIterator last, std::ostream &stream = std::cout)
+ {
+ return print( first, last, stream, default_format(), default_container_policy());
+ }
+
 
 // Danny, this doesn't appear to work. When I call print passing in a stringstream, this
 // is the function that gets called. When printing a streamed type, the type is always streamed


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