Boost logo

Boost :

Subject: [boost] [Algorithm] Incorrect behavior of is_sorted_until (predicate version)
From: Michel Morin (mimomorin_at_[hidden])
Date: 2012-07-11 19:53:23

Hi Marshall,

Suppose we have an array
    int ar[5] = {1, 2, 2, 2, 2};
Then, `is_sorted_until(ar, ar + 5, std::less<int>())` should return
`ar`'s end pointer. But it gives `ar + 2`.

To fix this, change line 49 of is_sorted.hpp
    if ( !p ( *first, *next )) return next;
    if ( p ( *next, *first )) return next;
After fixing it, don't forget to change the predicate
used in non-predicate version of is_sorted_until ;)

Spotted by "clang-cxx11-r159746" test runner.


Boost list run by bdawes at, gregod at, cpdaniel at, john at