Problem with passing a struct array

The Partridge Family were neither partridges nor a family. Discuss.
User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Problem with passing a struct array

Post by LuX » June 27th, 2013, 10:33 am

@LuisR14 haha, damn. Well I think I got it now.
ʕ •ᴥ•ʔ

User avatar
LuisR14
Posts: 1248
Joined: May 23rd, 2013, 3:52 pm
Location: USA
Contact:

Re: Problem with passing a struct array

Post by LuisR14 » June 27th, 2013, 10:50 am

Shaki wrote:ALSO I learned that vectors are capable of doing alot of amazing things for passing this kind of data. :).
haha yea, that would've been another option (that i had thought of but didn't think of suggesting it xp)
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 :mrgreen: --

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Problem with passing a struct array

Post by albinopapa » June 27th, 2013, 7:35 pm

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

Shaki
Posts: 104
Joined: June 13th, 2012, 12:20 am

Re: Problem with passing a struct array

Post by Shaki » June 27th, 2013, 7:56 pm

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. :).

Post Reply