summaryrefslogtreecommitdiffstats
path: root/libcxx/test/support/counting_predicates.hpp
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2014-08-04 17:32:25 +0000
committerMarshall Clow <mclow.lists@gmail.com>2014-08-04 17:32:25 +0000
commit90ba0533cd5698839181478140d6be89bfa4b13c (patch)
tree10a227867015efcaea17c6ba259dc3e5a85262e1 /libcxx/test/support/counting_predicates.hpp
parentf6fabcc27bf34d2237749074b85784c95d3be4b5 (diff)
downloadbcm5719-llvm-90ba0533cd5698839181478140d6be89bfa4b13c.tar.gz
bcm5719-llvm-90ba0533cd5698839181478140d6be89bfa4b13c.zip
Fix PR#202520 - predicate called too many times in list::remove_if. Add tests for list, forward_list, and the std::remove_if algorithm
llvm-svn: 214736
Diffstat (limited to 'libcxx/test/support/counting_predicates.hpp')
-rw-r--r--libcxx/test/support/counting_predicates.hpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/libcxx/test/support/counting_predicates.hpp b/libcxx/test/support/counting_predicates.hpp
index 4e0f8fb7133..e825848fc48 100644
--- a/libcxx/test/support/counting_predicates.hpp
+++ b/libcxx/test/support/counting_predicates.hpp
@@ -11,16 +11,13 @@
#define __COUNTING_PREDICATES_H
-template <typename Predicate>
-struct unary_counting_predicate {
+template <typename Predicate, typename Arg>
+struct unary_counting_predicate : public std::unary_function<Arg, bool> {
public:
unary_counting_predicate(Predicate p) : p_(p), count_(0) {}
~unary_counting_predicate() {}
- typedef typename Predicate::argument_type argument_type;
- typedef bool result_type;
-
- bool operator () (const argument_type &a) const { ++count_; return p_(a); }
+ bool operator () (const Arg &a) const { ++count_; return p_(a); }
size_t count() const { return count_; }
void reset() { count_ = 0; }
OpenPOWER on IntegriCloud