
29 Oct
2011
29 Oct
'11
2:43 p.m.
Dave Abrahams wrote:
Here's another reason why the first formulation might not be such a hot idea: it rules out some obvious implementations that really ought to be OK. For example,
template <class InputIterator, class T> InputIterator find(InputIterator i, InputIterator j, T value) { while (i != j && !(*i == value)) ++i; return i; }
Yes, but this formulation doesn't need *i and value to be of the same type or operator== to be an equivalence relation. It just needs operator== to return something bool-ish. I've no problem with this requirement.