string as iterable Cpp code example
Example 1: string iterator in c++
// string::begin/end
#include <iostream>
#include <string>
int main ()
{
std::string str ("Test string");
for ( std::string::iterator it=str.begin(); it!=str.end(); ++it)
std::cout << *it << endl;
std::cout << '\n';
return 0;
}
Example 2: declaring iterator in cpp
vector<int>::iterator ptr;