PDA

Click to See Complete Forum and Search --> : Dynamic Arrays


kedaman
Dec 8th, 2000, 08:28 AM
I know how to create fixed arrays, and i've read there are a bunch of array classes out there but i don't know which to use. I need an array that is capable of (ordered by priority):
1. fast access
2. no extra memory (like arrays of pointers)
3. adding/removing single items, clearing
4. resizing
Also i would like a short summary of what array classes are good for what :) thanks

Chris_SE
Dec 8th, 2000, 12:56 PM
There are a few good ones. If you want a data array I would recommend APVector. The header can be found by a yahoo search easily. If you want multi-dimensions, APMatrix is good for matrices. If you want a good String header, APstring is great. All of these are completely dynamic. I've been working with them extensively lately. Also you can get and edit single indexes by just using there index value. Check them out. Wow, I was able to help Kedaman(*sniff, im so proud)

parksie
Dec 8th, 2000, 02:11 PM
Check out the STL classes. They're very good, and fast.

You'd need vector, string, list among others. SGI's developer site has loads of info and documentation. They come with VC++, by the way.

kedaman
Dec 8th, 2000, 06:32 PM
Thanks you parksie and Chris :) I'll try those, wheres the SGI's developer site? BTW, i have just single dimensioned arrays and I have a somewhat complex architecture of arrays in arrays, so i was wondering if there is something for hierarchy of arrays?

parksie
Dec 9th, 2000, 04:34 AM
A vector of a vector. :)

vector<vector<int> > TwoDArray; // Remember the space...

That space between the two >'s is important, otherwise the compiler thinks it's >> :(.

The STL is at: http://www.sgi.com/Technology/STL/index.html
You shouldn't need to download it, but the docs are useful.

kedaman
Dec 10th, 2000, 12:57 PM
Thanks parksie :)