|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r85400 - in trunk: boost/range/detail libs/range/test
From: zeratul976_at_[hidden]
Date: 2013-08-20 02:06:12
Author: nathanridge
Date: 2013-08-20 02:06:12 EDT (Tue, 20 Aug 2013)
New Revision: 85400
URL: http://svn.boost.org/trac/boost/changeset/85400
Log:
[range] Fixed a bug in join_iterator where joining a const range and a non-const range led to a compiler error (refs #8483).
Text files modified:
trunk/boost/range/detail/join_iterator.hpp | 8 ++++++--
trunk/libs/range/test/join.cpp | 13 +++++++++++++
2 files changed, 19 insertions(+), 2 deletions(-)
Modified: trunk/boost/range/detail/join_iterator.hpp
==============================================================================
--- trunk/boost/range/detail/join_iterator.hpp Tue Aug 20 01:11:14 2013 (r85399)
+++ trunk/boost/range/detail/join_iterator.hpp 2013-08-20 02:06:12 EDT (Tue, 20 Aug 2013) (r85400)
@@ -143,8 +143,12 @@
typename iterator_reference<Iterator2>::type
>::type
>::value,
- typename add_const<
- typename iterator_reference<Iterator2>::type
+ typename add_reference<
+ typename add_const<
+ typename remove_reference<
+ typename iterator_reference<Iterator2>::type
+ >::type
+ >::type
>::type,
typename iterator_reference<Iterator1>::type
>::type
Modified: trunk/libs/range/test/join.cpp
==============================================================================
--- trunk/libs/range/test/join.cpp Tue Aug 20 01:11:14 2013 (r85399)
+++ trunk/libs/range/test/join.cpp 2013-08-20 02:06:12 EDT (Tue, 20 Aug 2013) (r85400)
@@ -257,6 +257,18 @@
test_join_impl< std::vector<int>, std::deque<int> >();
test_join_impl< std::deque<int>, std::vector<int> >();
}
+
+ void test_join_iterator_reference_type_constness_ticket8483()
+ {
+ // Just test that this compiles.
+ // Before the fix for bug 8483, the reference type of the joined
+ // range's iterator was incorrect ('int&' instead of 'const int&'),
+ // causing compiler errors.
+ const std::vector<int> v1;
+ std::vector<int> v2;
+ std::vector<int> joined;
+ boost::push_back(joined, join(v1, v2));
+ }
}
}
@@ -268,6 +280,7 @@
= BOOST_TEST_SUITE( "RangeTestSuite.adaptor.joined" );
test->add( BOOST_TEST_CASE( &boost::join_test ) );
+ test->add( BOOST_TEST_CASE( &boost::test_join_iterator_reference_type_constness_ticket8483 ) );
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