Possible duplicate:
STL algorithms taking the whole container, not .begin (), end () like arg?
I studied some algorithms, and I wonder why some of them also do not have the variations that the container accepts.
For example, find can take a value in a container, and the algorithm can use an internal iterator over the container, calling begin and end container. The same thing with unique_copy , where it seems to me more useful to pass the container, and the algorithm uses push_back instead of requiring an iterator, where I would have to resize the array to the maximum number of elements. for_each is another example.
I'm sure there are good reasons that I don’t know about?
source share