What Collection Types to Use? #733
Replies: 4 comments 3 replies
-
Here's an interesting one: https://www.boost.org/doc/libs/1_80_0/doc/html/boost/container/static_vector.html You can add and remove elements from it, but its memory storage is statically allocated, with a size specified at compile time. The memory just remains uninitialized until you actually add enough elements to fill it. We could perhaps use Perhaps we could even use it for Units. The comment at the top of the existing That sounds like a lot, but if I'm calculating correctly, those 20,000 Unit pointers would only require something like 80,000 or 160,000 bytes to store in memory. The actual What do you guys think? |
Beta Was this translation helpful? Give feedback.
-
Perhaps a better choice to hold Unit pointers is |
Beta Was this translation helpful? Give feedback.
-
Here's another interesting one: https://www.boost.org/doc/libs/1_80_0/doc/html/circular_buffer.html Sounds like this one performs much better on deletes. |
Beta Was this translation helpful? Give feedback.
-
For the Unit delete queue, I'm actually considering using a |
Beta Was this translation helpful? Give feedback.
-
I am trying to decide which STL, Boost, or other collection types to use in the Vega Strike Game Engine, for storing
Unit
s andOrder
s, among other things. Could use some help figuring out the best approach.Here are the C++ STL container types: https://en.cppreference.com/w/cpp/container
And the Boost container types: https://www.boost.org/doc/libs/1_80_0/?view=category_containers
The existing code has some custom collection types, as well as collection types that inherit from, and override, STL container types. Examples include
vsUMap
andLeakVector
.Beta Was this translation helpful? Give feedback.
All reactions