571
Life Advice / Re: Programming Issue. Linked Lists, Vectors, or what else???
« on: December 30, 2008, 06:01:41 pm »Quote
what would you think would be the best way to accomplish that? (thinking about memory, good clean coding, and all that). Making a linked list struct and placing it inside the sPerson struct? or what?
First, if you are using C++, why would you want to use structs instead of objects?
I would use a set. It's a part of STL. I don't think you should use a linked list, because order of items in inventory is irrelevant.
I would also consider making inventory a separate object, thus moving methods like get() and drop() from the person. There will be propably a lot of them.
Quote
anyway... I've been hearing that STL Links,vectors,queues etc are great... should I use those links as opposed to making my own? (speed differences?)
You shouldn't ever do by yourself anything that is in STL unless for the purpose of learning things. Especially not on this stage.