Thread: organizing data types

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    630

    organizing data types

    Hello

    I've been wondering how do you guys organize different data types in c++.

    For instance datatype customer:

    Code:
    class customer {
    public:
    
      std::string get_name() { return m_name; }
      std::string get_surname() { return m_surname; }
    
    private:
      std::string m_name;
      std::string m_surname;
    };
    
    class customer_list {
      typedef std::string data_type;
      typedef std::deque<data_type> list;
      typedef list::size_type size_type;
    };
    Or would you put
    Code:
    typedef std::string list_type;
    inside customer class?

    Many thanks in advance!

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    This code doesn't make any sense to me. Why is customer_list not just a typedef for std::list/vector/set<customer>?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bitmasking Problem
    By mike_g in forum C++ Programming
    Replies: 13
    Last Post: 11-08-2007, 12:24 AM
  2. Extending basic data types.
    By nempo in forum C++ Programming
    Replies: 23
    Last Post: 09-25-2007, 03:28 PM
  3. Replies: 4
    Last Post: 06-14-2005, 05:45 AM
  4. HUGE fps jump
    By DavidP in forum Game Programming
    Replies: 23
    Last Post: 07-01-2004, 10:36 AM
  5. Using enumerated data types
    By SXO in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2001, 06:26 PM