User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 392,078 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,049 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
Views: 668 | Replies: 1
Reply
Join Date: Nov 2006
Posts: 3
Reputation: bencwai is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
bencwai bencwai is offline Offline
Newbie Poster

C++, difficulties in choosing STL 's containers

  #1  
Nov 30th, 2006
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~
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Location: Plantation, FL
Posts: 14
Reputation: nattylife is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 3
nattylife nattylife is offline Offline
Newbie Poster

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

  #2  
Nov 30th, 2006
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb C++ Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 12:18 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC