Hi,
I'm now learning the principes of a list, but it doesn't work :(
A tutorial tells me to use this code:
list<int>::iterator i = 0;
But it gives the error:
error C2440: 'initializing' : cannot convert from 'int' to 'std::list<_Ty>::_Iterator<_Secure_validation>'
I copied it exactly and this should work. What is wrong here?
EDIT:
This same code is even used on a wikipedia page; what's wrong? :(
Last edited on
You (usually) can't assign an integer to an iterator. You should use
list<int>::iterator i = yourList.begin();
Thank you, that seems to work :)