oryol
oryol copied to clipboard
'Embedded' versions of all container classes
There should be an embedded version for each dynamic container class that never does heap allocation, but instead has the maximum capacity as a template argument similar to the StaticArray class. This would be especially be useful for small arrays that should still behave like a dynamic container.
thought: to prevent template-bloat the actual storage should be kept in a separate ArrayBuffer<TYPE,SIZE> class, and all container classes should accept such a ArrayBuffer class in their constructor:
class MyClass {
...
ArrayBuffer<MyItem,64> itemBuffer;
Array<MyItem> items = Array<MyItem>(itemBuffer);
...
};
hmm this looks mighty ugly...