Daily bit(e) of C++ | Dependency injection
Daily bit(e) of C++ #117, The dependency injection design pattern.
Dependency injection is a simple design pattern that decouples a component from its dependency.
While the pattern introduces a virtual dispatch (with its runtime cost), its simplicity and effect on testability are usually worth it.
simple, though powerful, useful and important
I've been looking for a way to do this at compile time using templates but haven't found a solution. Is such a thing possible?