Data type in List stl

in list class what is the data type of iterator
for(auto it = l.begin();it!=l.end();it++)
{
cout<<*it<<endl;
}

it depends on datatype that iterator is iterating eg , for list iterator it should be list::iterator, for map it should be map::iterator ,for set it is set::iterator, they are kind of smart pointer but there are several classifications inside iterators itself , if you want to dig in deep then i would suggest you to refer this :-
http://www.cplusplus.com/reference/iterator/

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

1 Like