From 71128814293b4244ba029b21a503291360068af0 Mon Sep 17 00:00:00 2001 From: Brian Rodriguez Date: Tue, 29 Sep 2015 12:06:21 -0400 Subject: [PATCH] T.40 typo: `find` to `find_if` `std::find` accepts a value, not a function object. `std::find_if` was the intended function. --- CppCoreGuidelines.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index 74f0441..f200708 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -9058,9 +9058,9 @@ In general, passing function objects give better performance than passing pointe sort(v, greater<>); // function object bool greater_than_7(double x) { return x>7; } - auto x = find(v, greater_than_7); // pointer to function: inflexible - auto y = find(v, [](double x) { return x>7; }); // function object: carries the needed data - auto y = find(v, Greater_than(7)); // function object: carries the needed data + auto x = find_if(v, greater_than_7); // pointer to function: inflexible + auto y = find_if(v, [](double x) { return x>7; }); // function object: carries the needed data + auto y = find_if(v, Greater_than(7)); // function object: carries the needed data ??? these lambdas are crying out for auto parameters -- any objection to making the change?