| 142 | /// Similiar to std::remove_if but instead pass adjacent pairs to the predicate |
| 143 | template <class Iterator, class Predicate> |
| 144 | Iterator adjacent_remove_if(Iterator first, Iterator last, Predicate p) |
| 145 | { |
| 146 | first = std::adjacent_find(first, last, p); |
| 147 | if(first == last) |
| 148 | return first; |
| 149 | auto i = first; |
| 150 | while(std::next(++i) != last) |
| 151 | { |
| 152 | if(not p(*i, *std::next(i))) |
| 153 | { |
| 154 | *first = std::move(*i); |
| 155 | ++first; |
| 156 | } |
| 157 | } |
| 158 | *first = std::move(*i); |
| 159 | ++first; |
| 160 | return first; |
| 161 | } |
| 162 | |
| 163 | /// Similiar to std::for_each but instead pass adjacent pairs to the function |
| 164 | template <class Iterator, class F> |
no outgoing calls
no test coverage detected