One of the most obvious distinction will be reflected by that
- if you use std:vector to store a list of element
- then try to pass the address of the element (e.g. &vec[i]) around as reference to that element, it will not work as std:vec resize and rellocate itself to somewhere else as its size changes (so that it can occupy a set of contiguous memory spaces)
- std:deque does not have this problem, but the memory space it occupies could be scattered to anywhere
No comments:
Post a Comment