Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

static allocated data structures

I'm working on a existing embedded system (memory is limited, Flash is limited, ...) with an RT OS. All data structures have a fixed size and are allocated at "compile time" and are therefore suited for RT. There is no dynamic memory allocation. The programming language is C++, but there is no STL available. I like to replace some of the data structures especially LinkedList, Vector and Map with some more generic variants.

The closest I've seen so far is the following framework: http://apfw.sourceforge.net/. The biggest draw back IMHO is that the for a LinkedList with size N, the default constructor from T is called N times. A better class should statically allocate sizeof(T)*N bytes.

Does anyone know I library with all of the above constraints?

like image 571
azraiyl Avatar asked Aug 21 '26 05:08

azraiyl


1 Answers

Have you considered passing your own allocator (allocating from a static pool) to STL containers?

Other than that, I don't think anything like this exists. You might want to look at this related question to get started with a static vector class. If you do this, consider to make it Open Source.

like image 143
sbi Avatar answered Aug 24 '26 07:08

sbi