Q:

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

0

 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?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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.

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now