Boost logo

Boost-Commit :

From: jefffaust_at_[hidden]
Date: 2007-05-27 20:33:21


Author: jefffaust
Date: 2007-05-27 20:33:20 EDT (Sun, 27 May 2007)
New Revision: 4326
URL: http://svn.boost.org/trac/boost/changeset/4326

Log:
Create explore::make_iterator_range. Fix ADL issue with ranges.

Text files modified:
   sandbox/explore/libs/explore/test/boost_range.cpp | 40 +++++++++++++++-------------------------
   1 files changed, 15 insertions(+), 25 deletions(-)

Modified: sandbox/explore/libs/explore/test/boost_range.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/boost_range.cpp (original)
+++ sandbox/explore/libs/explore/test/boost_range.cpp 2007-05-27 20:33:20 EDT (Sun, 27 May 2007)
@@ -13,74 +13,64 @@
 #include <vector>
 #include <boost/range/iterator_range.hpp>
 #include "../../../boost/explore/stream_container.hpp"
+#include "../../../boost/explore/explore.hpp"
 
-//what's up here? I get a link error if I include explore.hpp
-//#include "../../../boost/explore/explore.hpp"
-
-BOOST_AUTO_TEST_CASE( boost_range_stream_test )
+BOOST_AUTO_TEST_CASE( boost_range_print_test )
 {
- using namespace explore;
     std::stringstream str_out;
 
- typedef std::vector<int> Cont;
- typedef boost::iterator_range<Cont::iterator> IterRange;
- typedef boost::iterator_range<Cont::reverse_iterator> RevIterRange;
- Cont vi;
- str_out << as_container(IterRange(vi));
+ std::vector<int> vi;
+ explore::print(boost::make_iterator_range(vi), str_out);
     BOOST_CHECK_EQUAL(str_out.str(), "[]");
 
     str_out.str("");
 
     vi.push_back(1);
- str_out << as_container(IterRange(vi));
+ explore::print(boost::make_iterator_range(vi), str_out);
     BOOST_CHECK_EQUAL(str_out.str(), "[1]");
 
     str_out.str("");
 
     vi.push_back(2);
     vi.push_back(3);
- str_out << as_container(IterRange(vi));
+ explore::print(boost::make_iterator_range(vi), str_out);
     BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
 
     str_out.str("");
- str_out << as_container(IterRange(vi.begin()+2, vi.end()));
+ explore::print(boost::make_iterator_range(vi.begin()+2, vi.end()), str_out);
     BOOST_CHECK_EQUAL(str_out.str(), "[3]");
 
     str_out.str("");
- str_out << as_container(RevIterRange(vi.rbegin(), vi.rend()));
+ explore::print(boost::make_iterator_range(vi.rbegin(), vi.rend()), str_out);
     BOOST_CHECK_EQUAL(str_out.str(), "[3, 2, 1]");
 }
 
-#include "../../../boost/explore/explore.hpp"
-BOOST_AUTO_TEST_CASE( boost_range_print_test )
+BOOST_AUTO_TEST_CASE( boost_range_stream_test )
 {
     std::stringstream str_out;
 
- typedef std::vector<int> Cont;
- typedef boost::iterator_range<Cont::iterator> IterRange;
- typedef boost::iterator_range<Cont::reverse_iterator> RevIterRange;
- Cont vi;
- explore::print(IterRange(vi), str_out);
+ std::vector<int> vi;
+ str_out << explore::make_iterator_range(vi);
     BOOST_CHECK_EQUAL(str_out.str(), "[]");
 
     str_out.str("");
 
     vi.push_back(1);
- explore::print(IterRange(vi), str_out);
+ str_out << explore::make_iterator_range(vi);
     BOOST_CHECK_EQUAL(str_out.str(), "[1]");
 
     str_out.str("");
 
     vi.push_back(2);
     vi.push_back(3);
- explore::print(IterRange(vi), str_out);
+ str_out << explore::make_iterator_range(vi);
     BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
 
     str_out.str("");
- explore::print(IterRange(vi.begin()+2, vi.end()), str_out);
+ str_out << explore::make_iterator_range(vi.begin()+2, vi.end());
     BOOST_CHECK_EQUAL(str_out.str(), "[3]");
 
     str_out.str("");
- explore::print(RevIterRange(vi.rbegin(), vi.rend()), str_out);
+ str_out << explore::make_iterator_range(vi.rbegin(), vi.rend());
     BOOST_CHECK_EQUAL(str_out.str(), "[3, 2, 1]");
 }


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