STL question

ElDonAntonio

Senior member
Aug 4, 2001
967
0
0
I read that only random access iterators support operations such as "+(int)" or comparison operators. Are random access iterators only valid with vectors and deques? can't they be used with a list?

Thanks guys!
 

singh

Golden Member
Jul 5, 2001
1,449
0
0
The reasons others don't support them is because their underlying data structures do not provide (efficient) access to randomly access an element. Lists are implemented using linked-lists, so you don't expect them to provide random access.