I have to redesign a bookshop programme which allow user to make order of books.
This programme is originally using vector to implement.Now i have to decide either use deque or hash_map for the programme or i would better keep using vector??

In fact, I just know these three kinds of containers in STL.Are there any other choices in STL???


Thank you so much~

hash-map(or hash tables) are usually used for getting retrieval of records in O(n) time... something you'd see in a database design. vector is probably the quickest and simplest way to go:
- its dynamically re-sizable
- you can access any element in linear time.
as your customer orders book, its as simple as pushing back the the book onto your order vector.
my vote says staty with the vector. but if you dont/ cant use a vector, theres always a linked list (doubly linked list) too.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.