1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // template <class Pred> void remove_if(Pred pred);
18 #include "min_allocator.h"
19 #include "counting_predicates.hpp"
31 typedef unary_counting_predicate<bool(*)(int), int> Predicate;
36 int a1[] = {1, 2, 3, 4};
38 std::list<int> c(a1, a1+4);
40 c.remove_if(std::ref(cp));
41 assert(c == std::list<int>(a2, a2+2));
42 assert(cp.count() == 4);
45 int a1[] = {1, 2, 3, 4};
47 std::list<int> c(a1, a1+4);
49 c.remove_if(std::ref(cp));
50 assert(c == std::list<int>(a2, a2+2));
51 assert(cp.count() == 4);
53 #if __cplusplus >= 201103L
55 int a1[] = {1, 2, 3, 4};
57 std::list<int, min_allocator<int>> c(a1, a1+4);
59 c.remove_if(std::ref(cp));
60 assert((c == std::list<int, min_allocator<int>>(a2, a2+2)));
61 assert(cp.count() == 4);