Why should i use this??

Hello,
I'm wondering what the benefits of iterators are?

1
2
3
4
5
6
7
8
9
  //stl style iterator
   QString::const_iterator i;
   for (i = str.constBegin();i != str.constEnd();++i)
       qDebug() << (*i) << str.length();
  
  // old methode 
   int size = str.length();
   for (int i=0;i<size;++i)
       qDebug() << str.at(i) << str.length(); //str.at(i) faster (only reader) than str[i]; 


btw there's a java style iterator to. Why?
Topic archived. No new replies allowed.