I'm writing some kind of DI container in c++ and I'm curious if it's possible to create aliases from one type to another in modern c++. What I basicly want to do is to be able to call implementation constructor by it's aliased interface. Like so:
di::Register<Interface, Impl>();
di::Resolve<Interface>(); // -> Impl should be resolved
The problem is that I've not been able to find the way to alias Interface and Impl in compile time so far. I can do this using RTTI but I really don't want to use it. Is it possible at all?
Aucun commentaire:
Enregistrer un commentaire