Problem with passing a struct array
Re: Problem with passing a struct array
haha yea, that would've been another option (that i had thought of but didn't think of suggesting it xp)Shaki wrote:ALSO I learned that vectors are capable of doing alot of amazing things for passing this kind of data. .
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: Problem with passing a struct array
Isn't using the vector function costly? Is it any more expensive than using new and delete, or is it the same? I suppose the vector function would be best suited for random resizing and the new/delete route would be more useful for persistent data.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
Re: Problem with passing a struct array
No, vector is apart of the standard template library, and it costs very little actually, only slightly more memory space, but terms of speed it's faster as you don't need to calculate the space to find an index, you actually can take the memory logged one, which will save a cycle. .