(Note: I rely only on the overly short boost :: fusion documentation that I have to create a new vector every time I call push_back.)
You are not creating a new vector. push_back returns a lazily evaluated view in extended sequence. If you want to create a new vector, then, for example, typedef NewStuff as
typedef fusion::vector<Base*, Alpha*, Bravo*, Base*, Alpha*> NewStuff;
Your program then works.
Btw, a merger is a very functional design. I think this will be more merging if you were to store actual objects, not pointers, and use transform . The logic of chug will then be transferred from classes to struct chug , which had a suitable operator() for each type. Then there was no need to create new vectors, you could work with lazily evaluated representations.
source share