Ticket #6888: unique_bug.cpp
File unique_bug.cpp, 415 bytes (added by , 10 years ago) |
---|
Line | |
---|---|
1 | #include <boost/range/algorithm.hpp> |
2 | #include <vector> |
3 | #include <numeric> |
4 | #include <cassert> |
5 | |
6 | struct greater_by_two |
7 | { |
8 | template <class T> |
9 | bool operator()(const T& left, const T& right) const |
10 | { |
11 | return left / 2 == right / 2; |
12 | } |
13 | }; |
14 | |
15 | int main() |
16 | { |
17 | std::vector<int> v(10); |
18 | std::iota(v.begin(), v.end(), 0); |
19 | |
20 | assert(boost::unique(v, greater_by_two()).size() == 5); |
21 | } |