Error in algo3 remove_if test
The following code passes the remove_if test:
template <typename Iterator, typename Predicate>
inline Iterator remove_if(Iterator first, Iterator last, Predicate predicate) {
auto it = first;
for (auto jt = first; jt != last; ++jt)
if (!predicate(*jt)) {
// std::swap(*it, *jt);
it++;
}
return it;
}
Adding another point to the test fixes the issue.
auto p0 = Point{3, 1, 1};
auto p1 = Point{2, 2, 2};
auto p2 = Point{2, 2, 1};
auto p3 = Point{3, 4, 3};
auto p4 = Point{3, 3, 4};
const Container ref = {p0, p1, p2, p3, p4};