| 1709 | // O(n^2) |
| 1710 | template <typename Container, typename BinaryPredicate> |
| 1711 | Container 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 |
no test coverage detected