[range] Fixed a bug in join_iterator where joining a const range and a non-const range led to a compiler error (refs #8483).

[SVN r85400]
This commit is contained in:
Nathan Ridge
2013-08-20 06:06:12 +00:00
parent 58d1ee1444
commit 4c28983459
2 changed files with 19 additions and 2 deletions

View File

@ -143,8 +143,12 @@ template<typename Iterator1
typename iterator_reference<Iterator2>::type typename iterator_reference<Iterator2>::type
>::type >::type
>::value, >::value,
typename add_const< typename add_reference<
typename iterator_reference<Iterator2>::type typename add_const<
typename remove_reference<
typename iterator_reference<Iterator2>::type
>::type
>::type
>::type, >::type,
typename iterator_reference<Iterator1>::type typename iterator_reference<Iterator1>::type
>::type >::type

View File

@ -257,6 +257,18 @@ namespace boost
test_join_impl< std::vector<int>, std::deque<int> >(); test_join_impl< std::vector<int>, std::deque<int> >();
test_join_impl< std::deque<int>, std::vector<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 @@ init_unit_test_suite(int argc, char* argv[])
= BOOST_TEST_SUITE( "RangeTestSuite.adaptor.joined" ); = BOOST_TEST_SUITE( "RangeTestSuite.adaptor.joined" );
test->add( BOOST_TEST_CASE( &boost::join_test ) ); test->add( BOOST_TEST_CASE( &boost::join_test ) );
test->add( BOOST_TEST_CASE( &boost::test_join_iterator_reference_type_constness_ticket8483 ) );
return test; return test;
} }