Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84617 - in trunk: boost/range/adaptor libs/range/test libs/range/test/adaptor_test
From: zeratul976_at_[hidden]
Date: 2013-06-03 05:00:47


Author: nathanridge
Date: 2013-06-03 05:00:46 EDT (Mon, 03 Jun 2013)
New Revision: 84617
URL: http://svn.boost.org/trac/boost/changeset/84617

Log:
[range] Make iterator of 'indexed' adaptor default-constructible (refs #7827).
Added:
   trunk/libs/range/test/test_utils.hpp (contents, props changed)
Text files modified:
   trunk/boost/range/adaptor/indexed.hpp | 3 +++
   trunk/libs/range/test/adaptor_test/indexed.cpp | 6 ++++++
   2 files changed, 9 insertions(+), 0 deletions(-)

Modified: trunk/boost/range/adaptor/indexed.hpp
==============================================================================
--- trunk/boost/range/adaptor/indexed.hpp (original)
+++ trunk/boost/range/adaptor/indexed.hpp 2013-06-03 05:00:46 EDT (Mon, 03 Jun 2013)
@@ -55,6 +55,9 @@
             index_type m_index;
 
         public:
+ indexed_iterator()
+ : m_index(index_type()) {}
+
             explicit indexed_iterator( Iter i, index_type index )
             : base(i), m_index(index)
             {

Modified: trunk/libs/range/test/adaptor_test/indexed.cpp
==============================================================================
--- trunk/libs/range/test/adaptor_test/indexed.cpp (original)
+++ trunk/libs/range/test/adaptor_test/indexed.cpp 2013-06-03 05:00:46 EDT (Mon, 03 Jun 2013)
@@ -15,11 +15,14 @@
 
 #include <boost/assign.hpp>
 #include <boost/range/algorithm_ext.hpp>
+#include <boost/range/concepts.hpp>
 
 #include <algorithm>
 #include <list>
 #include <vector>
 
+#include "../test_utils.hpp"
+
 namespace boost
 {
     namespace
@@ -83,6 +86,9 @@
         {
             indexed_test_impl< std::vector< int > >();
             indexed_test_impl< std::list< int > >();
+
+ check_random_access_range_concept(std::vector<int>() | boost::adaptors::indexed(0));
+ check_bidirectional_range_concept(std::list<int>() | boost::adaptors::indexed(0));
         }
     }
 }

Added: trunk/libs/range/test/test_utils.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/range/test/test_utils.hpp 2013-06-03 05:00:46 EDT (Mon, 03 Jun 2013)
@@ -0,0 +1,24 @@
+// Boost.Range library
+//
+// Copyright Akira Takahashi 2013. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+//
+// For more information, see http://www.boost.org/libs/range/
+//
+
+#include <boost/range/concepts.hpp>
+
+template <class RandomAccessRng>
+void check_random_access_range_concept(const RandomAccessRng& rng)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( boost::RandomAccessRangeConcept<RandomAccessRng> ));
+}
+
+template <class BidirectionalRng>
+void check_bidirectional_range_concept(const BidirectionalRng& rng)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( boost::BidirectionalRangeConcept<BidirectionalRng> ));
+}


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