MCPcopy Create free account
hub / github.com/Dobiasd/FunctionalPlus / nub_by

Function nub_by

include/fplus/container_common.hpp:1711–1722  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1709// O(n^2)
1710template <typename Container, typename BinaryPredicate>
1711Container nub_by(BinaryPredicate p, const Container& xs)
1712{
1713 Container result;
1714 auto itOut = internal::get_back_inserter(result);
1715 for (const auto& x : xs) {
1716 auto eqToX = bind_1st_of_2(p, x);
1717 if (!is_elem_of_by(eqToX, result)) {
1718 *itOut = x;
1719 }
1720 }
1721 return result;
1722}
1723
1724// API search type: nub_on : ((a -> b), [a]) -> [a]
1725// fwd bind count: 1

Callers 4

nub_onFunction · 0.70
nubFunction · 0.70
all_unique_by_eqFunction · 0.70

Calls 3

get_back_inserterFunction · 0.70
bind_1st_of_2Function · 0.70
is_elem_of_byFunction · 0.70

Tested by

no test coverage detected