Talk:cpp/named req/Predicate
From cppreference.com
"The Predicate concept describes a function object that takes a single iterator argument that is dereferenced" No, that would be a UnaryPredicate, there are other kinds of predicate that take more than one argument, e.g. BinaryPredicate!
And phrasing it in terms of iterators is just confusing, the way it's written it implies the predicate takes an iterator argument and then dereferences it. That's nonsense. The predicate takes an argument, period. Often that argument is obtained by dereferencing an iterator, but that is not a property of the predicate and has nothing to do with the requirements of the concept.
- You're right, that's why the page says
. The current description is actually fairly close to the standard definition from 25.1[algorithms.general]p8 "The Predicate parameter is used whenever an algorithm expects a function object (20.9) that, when applied to the result of dereferencing the corresponding iterator, returns a value testable as true." --Cubbi (talk) 11:03, 22 November 2014 (PST)This section is incomplete
Reason: better describe actual requirements
- There is also a kind of predicate that take no argument, defined in 30.2.1[thread.req.paramname] :) I think it's reasonable to give this concept a clearer name here, even though the standard uses bare "Predicate". --D41D8CD98F (talk) 05:14, 23 November 2014 (PST)
Tried to fix some issues, please review (it's still very short), and correct as necessary.