Results 1 to 6 of 6

Thread: Dynamic Arrays

  1. #1

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  2. #2
    Addicted Member
    Join Date
    Aug 2000
    Location
    Columbus Ohio
    Posts
    217

    ApString all the way

    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)
    Chris

    [email protected]
    Windows XP RC2 B2526
    Visual Studio.Net Beta 2
    C++, VB, VB.Net, ASP, PHP

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  4. #4

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    A vector of a vector.
    Code:
    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.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  6. #6

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Thanks parksie
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width