lundi 28 septembre 2015

How to get more detail about the identifier of auto in iterator of C++11

 void test()
 {
       vector <string> s={"hello world"};
       for(vector<string>::iterator it=s.begin();it!=s.end()&&!it->empty();it++)
      {
           for(auto it2=it->begin();it2!=it->end();it2++)//I don't konw  type of it2
           {
                *it2=toupper(*it2);
           }
       cout<<*it<<endl;
     }
}

In the first loop I can sure that iterator of type is vector<string>::iterator. I wonder what is type of the it2 (I have already tried use vector<string>::const). And how can I get the more detail about which type did auto equal.

Aucun commentaire:

Enregistrer un commentaire