Thread: array of classes

  1. #1
    Registered User
    Join Date
    Jan 2008

    array of classes

    Is here a way to create an array that can grow as my input file grows and that can hold classes in C++ or C# and how do I do it, or would I be better of using a Red Black Tree?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    You can use the std::vector container. If you want a sorted container, a std::set or std::map (both typically implemented with a balanced binary tree such as a red-black tree) might be appropriate.
    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Overloading Array Objects for use with Classes
    By ibleedart in forum C++ Programming
    Replies: 2
    Last Post: 10-24-2007, 06:48 PM
  2. Modify an single passed array element
    By swgh in forum C Programming
    Replies: 3
    Last Post: 08-04-2007, 08:58 AM
  3. Char array and classes
    By Heineken in forum C++ Programming
    Replies: 3
    Last Post: 04-25-2005, 12:32 PM
  4. two-dimensional dynamic array of pointers to classes
    By Timo002 in forum C++ Programming
    Replies: 4
    Last Post: 04-21-2005, 06:18 AM
  5. array of classes in C++
    By stanleyw in forum C++ Programming
    Replies: 2
    Last Post: 05-29-2002, 08:20 PM