mirror of
https://github.com/boostorg/utility.git
synced 2025-05-08 18:34:02 +00:00
Fix for newly-corrected bidirectional_iterator_test requirements.
[SVN r8926]
This commit is contained in:
parent
c060e4466a
commit
d8a9b633d9
@ -6,7 +6,7 @@
|
|||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org for most recent version including documentation.
|
||||||
//
|
//
|
||||||
// Revision History
|
// Revision History
|
||||||
// 04 Jan 2001 Added use of iterator_tests.hpp (David Abrahams)
|
// 04 Feb 2001 Added use of iterator_tests.hpp (David Abrahams)
|
||||||
// 28 Jan 2001 Removed not_an_iterator detritus (David Abrahams)
|
// 28 Jan 2001 Removed not_an_iterator detritus (David Abrahams)
|
||||||
// 24 Jan 2001 Initial revision (David Abrahams)
|
// 24 Jan 2001 Initial revision (David Abrahams)
|
||||||
|
|
||||||
@ -73,20 +73,31 @@ void category_test(
|
|||||||
// Show that values outside the range can't be found
|
// Show that values outside the range can't be found
|
||||||
assert(!std::binary_search(start, boost::prior(finish), *finish));
|
assert(!std::binary_search(start, boost::prior(finish), *finish));
|
||||||
|
|
||||||
// Do generic random_access_iterator_test
|
// Do the generic random_access_iterator_test
|
||||||
typedef typename CountingIterator::value_type value_type;
|
typedef typename CountingIterator::value_type value_type;
|
||||||
std::vector<value_type> v;
|
std::vector<value_type> v;
|
||||||
for (value_type z = *start; z != *finish; ++z)
|
for (value_type z = *start; z != *finish; ++z)
|
||||||
v.push_back(z);
|
v.push_back(z);
|
||||||
boost::random_access_iterator_test(start, v.size(), v.begin());
|
if (v.size() >= 2)
|
||||||
|
{
|
||||||
|
// Note that this test requires a that the first argument is
|
||||||
|
// dereferenceable /and/ a valid iterator prior to the first argument
|
||||||
|
boost::random_access_iterator_test(start + 1, v.size() - 1, v.begin() + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special tests for bidirectional CountingIterators
|
// Special tests for bidirectional CountingIterators
|
||||||
template <class CountingIterator>
|
template <class CountingIterator>
|
||||||
void category_test(CountingIterator start, CountingIterator finish, std::bidirectional_iterator_tag)
|
void category_test(CountingIterator start, CountingIterator finish, std::bidirectional_iterator_tag)
|
||||||
{
|
{
|
||||||
if (finish != start && finish != boost::next(start))
|
if (finish != start
|
||||||
boost::bidirectional_iterator_test(start, *start, boost::next(*start));
|
&& finish != boost::next(start)
|
||||||
|
&& finish != boost::next(boost::next(start)))
|
||||||
|
{
|
||||||
|
// Note that this test requires a that the first argument is
|
||||||
|
// dereferenceable /and/ a valid iterator prior to the first argument
|
||||||
|
boost::bidirectional_iterator_test(boost::next(start), boost::next(*start), boost::next(boost::next(*start)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class CountingIterator>
|
template <class CountingIterator>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user