In my .NET project, I have some code that creates new objects according to an xml. The Activator is the heart of what makes this possible. Is there a similar thing I can do in c++? I’ve found some IOC/DI frameworks, but I really don’t need much functionality. The alternative is of course to simply write a switch, but that would need to be modified (along with the XML) each time I come up with a new type.
Share
The coolest C++ implementation of a “superfactory” is one by my good friend Francis and you can find the article here on CodeProject.
I believe he wrote this factory with exactly this need in mind. It also powers his (de)serialization framework Daabli that reads plaintext C-style (and with some work – JSON, XML) files and recreates object graphs.
Hope this helps!