Template talk:par pred1

void* pred(Type &a); Works too (on a non-const range);

void* pred(convertibe b); as well.

The predicate-requirements are far too stringently formulated.

94.220.161.15 17:53, 15 November 2014 (PST)


 * Actually Predicate cannot be a function, because it must be a function object, such as a pointer-to-function! Agree that the wording needs to be improved. --D41D8CD98F (talk) 04:20, 23 November 2014 (PST)

Typo in "nor is Type1 unless for Type1 a move is equivalent to a copy"
This should most likely read "(thus, Type1 & is not allowed, nor is Type1&& unless for Type1 a move is equivalent to a copy (since C++11))."

if the intent is to limit modification of v (although I need to check the standardese if that intent is correct since as other posters mention, the compiler(s) accept predicates which take T&) relevant standardese, 25.2 par8:

When not otherwise constrained, the BinaryPredicate parameter is used whenever an algorithm expects a function object that when applied to the result of dereferencing two corresponding iterators or to dereferencing an iterator and type T when T is part of the signature returns a value testable as true. In other words, if an algorithm takes BinaryPredicate binary_pred as its argument and first1 and first2 as its iterator argu�ments with respective value types T1 and T2, it should work correctly in the construct binary_pred(*first1, the first iterator’s value_type as its first argument, that is, in those cases when T value is part of the signature, it should work correctly in the construct binary_pred(*first1, value) contextually converted to bool (7.3). binary_pred shall not apply any non-constant function through the dereferenced iterators. Given a glvalue u of type (possibly const) T1 that designates the same object as *first1, and a glvalue v of type (possibly const) T2 that designates the same object as *first2, binary_pred(u, *first2), binary_pred(*first1, v), and binary_pred(u, v) shall each be a valid expression that is equal to binary_pred(*first1, *first2), and binary_pred(u, value) shall be a valid expression that is equal to binary_pred(*first1, value).
 * first2) contextually converted to bool (7.3). Unless otherwise specified, BinaryPredicate always takes

Thus, a parameter type of or a parameter of type?
Shouldn't this be a parameter of type ...?

ticotico (talk)
 * grammatically, i'd just drop 'of'; "parameter type VT& is not allowed". Except of course as the previous comments in this Talk page say, it may not be technically correct in its attempt to summarize https://eel.is/c++draft/algorithms.requirements#6 and https://eel.is/c++draft/algorithms.requirements#7. --Cubbi (talk) 14:15, 15 October 2022 (PDT)