[index] fix varray const rbegin() and rend().

non-const reverse iterator type was used internally.
This commit is contained in:
Adam Wulkiewicz 2014-08-25 13:25:46 +02:00
parent be637c0929
commit 3560ae1c93
2 changed files with 15 additions and 8 deletions

View File

@ -1,6 +1,6 @@
// Boost.Container varray
//
// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2012-2014 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2011-2013 Andrew Hundt.
//
// Use, modification and distribution is subject to the Boost Software License,
@ -1406,7 +1406,7 @@ public:
//!
//! @par Complexity
//! Constant O(1).
const_reverse_iterator rbegin() const { return reverse_iterator(this->end()); }
const_reverse_iterator rbegin() const { return const_reverse_iterator(this->end()); }
//! @brief Returns const reverse iterator to the first element of the reversed container.
//!
@ -1418,7 +1418,7 @@ public:
//!
//! @par Complexity
//! Constant O(1).
const_reverse_iterator crbegin() const { return reverse_iterator(this->end()); }
const_reverse_iterator crbegin() const { return const_reverse_iterator(this->end()); }
//! @brief Returns reverse iterator to the one after the last element of the reversed container.
//!
@ -1442,7 +1442,7 @@ public:
//!
//! @par Complexity
//! Constant O(1).
const_reverse_iterator rend() const { return reverse_iterator(this->begin()); }
const_reverse_iterator rend() const { return const_reverse_iterator(this->begin()); }
//! @brief Returns const reverse iterator to the one after the last element of the reversed container.
//!
@ -1454,7 +1454,7 @@ public:
//!
//! @par Complexity
//! Constant O(1).
const_reverse_iterator crend() const { return reverse_iterator(this->begin()); }
const_reverse_iterator crend() const { return const_reverse_iterator(this->begin()); }
//! @brief Returns container's capacity.
//!

View File

@ -1,7 +1,7 @@
// Boost.Geometry.Index varray
// Unit Test
// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2012-2014 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2012-2013 Andrew Hundt.
// Use, modification and distribution is subject to the Boost Software License,
@ -283,8 +283,15 @@ void test_iterators_nd()
s.assign(v.rbegin(), v.rend());
test_compare_ranges(s.begin(), s.end(), v.rbegin(), v.rend());
test_compare_ranges(s.rbegin(), s.rend(), v.begin(), v.end());
test_compare_ranges(s.cbegin(), s.cend(), v.rbegin(), v.rend());
test_compare_ranges(s.crbegin(), s.crend(), v.begin(), v.end());
varray<T, N> const& cs = s;
std::vector<T> const& cv = v;
s.assign(cv.rbegin(), cv.rend());
test_compare_ranges(cs.begin(), cs.end(), cv.rbegin(), cv.rend());
test_compare_ranges(cs.rbegin(), cs.rend(), cv.begin(), cv.end());
}
template <typename T, size_t N>