Thread: Wich iterator best suit my needs?

  1. #1
    Registered User
    Join Date
    Dec 2012
    Posts
    6

    Wich iterator best suit my needs?

    I can't make up my mind on wich would be the best one. I am learning teaching by myself so I don't have anyone to ask exept you (thank God there is good people on the net).
    I am planning to translate a project I did in C in C++ using C++ powerful devices.
    The programm helps managing a list of invited people (users) and manage their confirmation and stuff, so in C I had used a dynamic allocated list of structs. The programm also saved the data onto a file so as not to loose them every run.
    Now i thought that in C++ it would be easier to use classes in place of structs, and now I am wondering how to organize the User Objects.
    Vector or List (or Deque)?
    My main needs will be:
    1) Add new user
    2) View users' list
    3) Modify user, therefore also being able to search for it (for long lists)
    4) Count confirmations
    5) Order them (may be usefull confirmation or name order)

    The list is probably gonna have a size of 50-300 users. I was afraid that the list way would have been stupid for accessing the users (i know 200 is nothing to moder PCs, but theoretically speaking...) while vector was probably better for acces due to its [].
    On the other hand list manage the data better on the ordering stuff, doesn't it?

    What do you advice?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    It looks like std::vector will do.

    Quote Originally Posted by AscanioFX
    The programm also saved the data onto a file so as not to loose them every run.
    As a further exercise, you could consider using SQLite or a similiar zero configuration embedded database engine.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Dec 2012
    Posts
    6
    The fact is that I don'y know anything about databases. I know they are dead usefull, but this programm is already an exercise for my C++ skills

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Connecting input iterator to output iterator
    By QuestionC in forum C++ Programming
    Replies: 2
    Last Post: 04-10-2007, 02:18 AM
  2. Making an MFC form to suit
    By TJJ in forum Windows Programming
    Replies: 1
    Last Post: 04-17-2004, 11:20 AM
  3. M$ phone suit
    By RoD in forum A Brief History of Cprogramming.com
    Replies: 20
    Last Post: 12-26-2002, 05:58 PM
  4. would a class suit?
    By DMaxJ in forum C++ Programming
    Replies: 5
    Last Post: 09-26-2002, 01:16 PM