Currently I develop a lightwight c++11 template based IOC Container for my engine. The IOC Container concept is quite new for me and I'm not realy smart with the concepts behind this mechanism. I think I've understand the basics and meantime I could register and resolve simple classes with and without dependencies. But now I'm struggling about multiple interface inheritance and primitive constructor parameters.
I.e. I've an interface for my shaders. Actually I create them by factory and decide which concrete shader has to create by simple enumeration flags.
What is the best way to solve this by the IOC Container, which acts like a factory? I've seen many different implementations, i.e:
1. Allow register and resolve of Instances by unique name id.
2. Allow parameter setting at resolve.
3. Register a factory and use in this case the factory pattern to create the concrete instances.
But I think often it's not correct and a fallback to the service pattern. What Do you think is the best way? And how you would handle sharing multiple instances of the same type? Or should I support all of this mechanisms?