Why do containers offer begin "/" end iterators, while algorithms need first "/" last iterators?
For example:
Edit: An even greater discrepancy is found. These are not just algorithms that use " first / last ", they are also container constructors (for example, vector(first, last, ...) ).
I did not check all the containers and algorithms, but I checked a few more and all the containers offered by begin / end , and all the algorithms wanted first / last (or options like first1 and first2 ).
Is there a good reason for this? It would be more reasonable for me if they all used the same thing. begin and end preferable, since I don't like last because it sounds inclusive, but it doesn't. For algorithms, this simply means the beginning and end of the range that will be processed, just like the first and last average.
c ++
Stefan pochmann
source share