943,907 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1530
  • C++ RSS
Nov 30th, 2006
0

C++, difficulties in choosing STL 's containers

Expand Post »
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~
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bencwai is offline Offline
3 posts
since Nov 2006
Nov 30th, 2006
0

Re: C++, difficulties in choosing STL 's containers

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.
Reputation Points: 10
Solved Threads: 3
Newbie Poster
nattylife is offline Offline
14 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: How to generate Graphics in Dev c++
Next Thread in C++ Forum Timeline: What does *&p do?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC