Running for loop depending on size of string vector

Posted by xbonez on Stack Overflow See other posts from Stack Overflow or by xbonez
Published on 2010-04-13T19:06:40Z Indexed on 2010/04/13 19:13 UTC
Read the original article Hit count: 156

Filed under:
|

I have made a string vector

vector actor_;

and then added elements in it using push_back.

I now want to display all of them, for which I need to run a loop according to the number of elements in the vector. For that, I need to run the following loop:

for (int i = 0; i < (int)actor_.size; i++) { }

but this returns the following error:


error C2440: 'type cast' : cannot convert from 'unsigned int (__thiscall std::vector<_Ty>::* )(void) const' to 'int' 1> with 1> [ 1> _Ty=std::string 1> ] 1> There is no context in which this conversion is possible


© Stack Overflow or respective owner

Related posts about c++

Related posts about vector