1) Is there any advantage to using iterators instead of [] like arrays?
Same advantage as using pointers for arrays. You can pass iterator arount without need for passing both container and index. Allows your functions to work even for containers which does not support random access.
2) What is the need for having two types of iterators - iterator and reverse iterator? Reverse iterator allows using same functions to iterate range forward and backward:
1 2
std::find(vec. begin(), vec. end(), some_value); //Finds FIRST entry of some_value
std::find(vec.rbegin(), vec.rend(), some_value); //Finds LAST entry of some_value
allows using same functions to iterate range forward and backward:
1 2
std::find(vec. begin(), vec. end(), some_value); //Finds FIRST entry of some_value
std::find(vec.rbegin(), vec.rend(), some_value); //Finds LAST entry of some_value
But why not use: std::find(vec.end(), vec.back(), some_value);
Because find() iterates forward. And as there is no elements after end() (and end() is not pointing tovalid element anyway) you will be luchky if it will just crash.