What is reverse_iterator?

what is reverse_iterator in c++?? is it a function or object or what??
and what do we mean by std::
1
2
3
4
5
6
7
8
9
10
11
12
// Example program
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string str="123";
    for(string::reverse_iterator r=str.rbegin();r<str.rend();r++)
    {
        cout<<*r;
    }
}


in the above code, what is "string::". What does it mean?? why do we use it??
You are referring to iQChange's post in your thread: http://www.cplusplus.com/forum/general/147831/#msg775640

std is namespace. C++ Standard Library identifiers use that namespace.

Do you know what an iterator is? It points to an element. It is an object.

std::string::reverse_iterator is a typename. Iterators to std::string differ from iterators to std::list.


The reference documentation has info about iterators and about std::string.
Topic archived. No new replies allowed.