A misunderstanding regarding STL containers
You might hear quotes likevectors are dynamic arrays
orlists are linked lists
these are not precise definitions. Although in practical situations it is safe to think of vectors as dynamic arrays or lists as linked lists (especially with the level of abstraction that we employ while designing our code); there is a whole different idea behind it. Standard Template library's perception of vector is something that provides cheap and fast access to the items; similarly, list is a container that performs item insertion and removal at its minimum cost, definitely when the implementers of these classes are doing their job, their first choice for internal representation of these structures are arrays and linked lists, but it is an excellent practice to think of them as independent concepts. If you think of a list as a linked list and an iterator as a pointer then it is hard to accept one of the main ideas behind containers and iterators that saysthese are two standalone entities, because linked list and pointers are completely one body.
No comments:
Post a Comment