C++ examples for STL:string
String reverse_iterator with rbegin() and rend(), const Iterators
#include <iostream> #include <string> using namespace std; int main(int argc, char *argv []) { /*from w w w .ja va 2s .c o m*/ string myString{ "This is my string!" }; for (string::const_iterator iter = myString.cbegin(); iter != myString.cend(); ++iter) { cout << *iter << endl; } for (string::const_reverse_iterator iter = myString.crbegin(); iter != myString.crend(); ++iter) { cout << *iter << endl; } return 0; }