jeudi 29 juillet 2021

Alternatives to normal polymorphism in embedded?

I've got a problem in my project for which polymorphism with heap allocation would be perfect. Unfortunately I'm not allowed to use any heap allocation. So I went on and implemented a way to have dynamic polymorphism on the stack. But as it turns out a simple test program which switched an led on and off used 7.1kb of flash just to create my custom vtables to copy the object correctly, this is way too much.

I've also tried out CTRP, but this wouldn't work either because I need to store the objects in a container.

What alternatives are there to normal C++ polymorphism, that don't require heap allocation and don't take up too much flash?

Aucun commentaire:

Enregistrer un commentaire