MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / adjacent_remove_if

Function adjacent_remove_if

src/include/migraphx/algorithm.hpp:144–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142/// Similiar to std::remove_if but instead pass adjacent pairs to the predicate
143template <class Iterator, class Predicate>
144Iterator 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
164template <class Iterator, class F>

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected