Could we define a map from vector<int>::iterator to int? What about from list<int>::iterator to int? In each case, if not, why not
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:11| Question number:10
All Answers
total answers (1)
We can define
`map<vector<int>::iterator, int>`
because the iterator of vector supports iterator arithmetic which includes`<`
operator.But we cannot define
`map<list<int>::iterator, int>`
because the iterator of list does not support iterator arithmetic and does not support`<`
operator.