Make wxVector::reverse_iterator satisfy RandomAccessIterator

RandomAccessIterator requirements include LessThanComparable, so
implement the missing comparison operators for this class, as well as
for const_reverse_iterator.

This also fixes compilation problems with MSVS 2013 in debug mode, where
the CRT uses these operators to check the iterators correctness.

See https://github.com/wxWidgets/wxWidgets/pull/1048
This commit is contained in:
Vadim Zeitlin
2018-12-07 14:52:51 +01:00
parent 3d75541662
commit aee926f2d5
2 changed files with 23 additions and 0 deletions

View File

@@ -365,6 +365,13 @@ TEST_CASE("wxVector::reverse_iterator", "[vector][reverse_iterator]")
CHECK( ri - rb == 2 );
CHECK( re - ri == 8 );
CHECK( rb < ri );
CHECK( rb <= ri );
CHECK( ri <= ri );
CHECK( ri >= ri );
CHECK( ri < re );
CHECK( ri <= re );
#if wxUSE_STD_CONTAINERS_COMPATIBLY
std::vector<int> stdvec(rb, re);
REQUIRE( stdvec.size() == 10 );