MCPcopy Create free account
hub / github.com/WheretIB/nullc / unique

Function unique

external/pugixml/pugixml.cpp:4864–4885  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4862 }
4863
4864 template <typename I> I unique(I begin, I end)
4865 {
4866 // fast skip head
4867 while (begin + 1 < end && *begin != *(begin + 1)) begin++;
4868
4869 if (begin == end) return begin;
4870
4871 // last written element
4872 I write = begin++;
4873
4874 // merge unique elements
4875 while (begin != end)
4876 {
4877 if (*begin != *write)
4878 *++write = *begin++;
4879 else
4880 begin++;
4881 }
4882
4883 // past-the-end (write points to live element)
4884 return write + 1;
4885 }
4886
4887 template <typename I> void copy_backwards(I begin, I end, I target)
4888 {

Callers 1

remove_duplicatesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected