Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84566 - in trunk: boost/range libs/range/test
From: zeratul976_at_[hidden]
Date: 2013-05-30 19:16:52


Author: nathanridge
Date: 2013-05-30 19:16:51 EDT (Thu, 30 May 2013)
New Revision: 84566
URL: http://svn.boost.org/trac/boost/changeset/84566

Log:
[range] Use correct iterator concepts when checking Boost.Range concepts (refs #6944).
Added:
   trunk/libs/range/test/ticket_6944.cpp (contents, props changed)
Text files modified:
   trunk/boost/range/concepts.hpp | 8 ++++----
   trunk/libs/range/test/Jamfile.v2 | 1 +
   2 files changed, 5 insertions(+), 4 deletions(-)

Modified: trunk/boost/range/concepts.hpp
==============================================================================
--- trunk/boost/range/concepts.hpp (original)
+++ trunk/boost/range/concepts.hpp 2013-05-30 19:16:51 EDT (Thu, 30 May 2013)
@@ -330,8 +330,8 @@
     struct BidirectionalRangeConcept : ForwardRangeConcept<T>
     {
 #if BOOST_RANGE_ENABLE_CONCEPT_ASSERT
- BOOST_RANGE_CONCEPT_ASSERT((BidirectionalIteratorConcept<BOOST_DEDUCED_TYPENAME BidirectionalRangeConcept::iterator>));
- BOOST_RANGE_CONCEPT_ASSERT((BidirectionalIteratorConcept<BOOST_DEDUCED_TYPENAME BidirectionalRangeConcept::const_iterator>));
+ BOOST_RANGE_CONCEPT_ASSERT((range_detail::BidirectionalIteratorConcept<BOOST_DEDUCED_TYPENAME BidirectionalRangeConcept::iterator>));
+ BOOST_RANGE_CONCEPT_ASSERT((range_detail::BidirectionalIteratorConcept<BOOST_DEDUCED_TYPENAME BidirectionalRangeConcept::const_iterator>));
 #endif
     };
 
@@ -348,8 +348,8 @@
     struct RandomAccessRangeConcept : BidirectionalRangeConcept<T>
     {
 #if BOOST_RANGE_ENABLE_CONCEPT_ASSERT
- BOOST_RANGE_CONCEPT_ASSERT((RandomAccessIteratorConcept<BOOST_DEDUCED_TYPENAME RandomAccessRangeConcept::iterator>));
- BOOST_RANGE_CONCEPT_ASSERT((RandomAccessIteratorConcept<BOOST_DEDUCED_TYPENAME RandomAccessRangeConcept::const_iterator>));
+ BOOST_RANGE_CONCEPT_ASSERT((range_detail::RandomAccessIteratorConcept<BOOST_DEDUCED_TYPENAME RandomAccessRangeConcept::iterator>));
+ BOOST_RANGE_CONCEPT_ASSERT((range_detail::RandomAccessIteratorConcept<BOOST_DEDUCED_TYPENAME RandomAccessRangeConcept::const_iterator>));
 #endif
     };
 

Modified: trunk/libs/range/test/Jamfile.v2
==============================================================================
--- trunk/libs/range/test/Jamfile.v2 (original)
+++ trunk/libs/range/test/Jamfile.v2 2013-05-30 19:16:51 EDT (Thu, 30 May 2013)
@@ -161,5 +161,6 @@
         [ range-test ticket_5544_terminate_irange ]
         [ range-test ticket_5547 ]
         [ range-test ticket_5556_is_sorted_namespace ]
+ [ range-test ticket_6944 ]
     ;
 

Added: trunk/libs/range/test/ticket_6944.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/range/test/ticket_6944.cpp 2013-05-30 19:16:51 EDT (Thu, 30 May 2013)
@@ -0,0 +1,45 @@
+// Boost.Range library
+//
+// Copyright Neil Groves 2011. 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/concept_check.hpp>
+#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/range/concepts.hpp>
+#include <boost/range/iterator_range.hpp>
+
+#include <boost/test/test_tools.hpp>
+#include <boost/test/unit_test.hpp>
+
+#include <vector>
+
+namespace boost
+{
+ namespace
+ {
+ // Ticket 6944 - Some Range concepts use the incorrect Iterator concept
+ typedef std::vector<int>::iterator iter_base;
+ struct iter : boost::iterator_adaptor<iter, iter_base, int, boost::use_default, int> {}; // will be deduced as random-access traversal but input category
+ typedef boost::iterator_range<iter> iter_range;
+ void test_ticket_6944()
+ {
+ BOOST_CONCEPT_ASSERT(( boost::RandomAccessRangeConcept<iter_range> ));
+ }
+ }
+}
+
+boost::unit_test::test_suite*
+init_unit_test_suite(int argc, char* argv[])
+{
+ boost::unit_test::test_suite* test
+ = BOOST_TEST_SUITE( "RangeTestSuite.ticket_6944" );
+
+ test->add( BOOST_TEST_CASE( &boost::test_ticket_6944 ) );
+
+ return test;
+}


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