oryol icon indicating copy to clipboard operation
oryol copied to clipboard

'Embedded' versions of all container classes

Open floooh opened this issue 10 years ago • 1 comments

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.

floooh avatar Aug 29 '15 10:08 floooh

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

floooh avatar Apr 04 '16 18:04 floooh