Skip to main content
gamedev.net
🔒 Locked

Dynamic Array (vectors) ... !?

Started by LowRad Aug 22, 2000 at 11:14 AM 4 replies 300+ views
Original Post
LowRad
LowRad
Hi all, I need to known, if there''s a way to store a Array that will change in size really often. I need to known this for storing my meshes in my 3D engine. I was thought of somethig similar to linkedlist, but it''s very long to parse it up. So did anyone have an idea ?! Thanks, LowRad
Kallen McInerney
Kallen McInerney
It may be easier to just allocate up to the max size array need but keep a counter as to how much of it your using. That''s the fastest way I can think of handling it.
Martee
Martee
Hey, I asked this same question not too long ago. One thing you can do is use malloc()/realloc() to change your array size dynamically.

Martee
Magnum Games
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
Knarkles
Knarkles
You should use STL, no need to reinvent the wheel.

-Jussi
LowRad
LowRad
Hi,

Thanks for those answers. I had already think about a predefined Array[Max_Object]. But i dont love this solution, i want it to be very versatile. So a Linked-List should work, but it''s very slow with a high number of object.

Slekrank : Hi, i''ve already heard about STL, but i''m not sure what that is? Did this is a bunch of classes (special lib)!?
Explain please. Thanks.


Thanks All,

And dont forget, Happy Coding

LowRad
Poltras
Poltras
quote:
Original post by LowRad
i''ve already heard about STL, but i''m not sure what that is? Did this is a bunch of classes (special lib)!?
Explain please. Thanks.



STL is a library of template classes. It contains many classes like linked lists, btrees and, of course, arrays. It is easy to use, but very controversed about speed... I personnally don''t think it''s speed effective. And it''s ANSI standardized.
If you want some infos on this topic, just go to this site.



Programming is:
A.The art of debugging a blank sheet of paper (or an empty file).
B.A pastime similar to banging one's head against a wall, but with fewer opportunities for reward.
C.The most fun you can have with your clothes on (although clothes are not mandatory).
Now I know what I'm made of, and I'm afraid of it...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.