Hypodermic is a non-intrusive header only IoC container for C++. It provides dependency injection to your existing design by managing the creation of your components and their dependencies in the right order, sparing you the trouble of writing and maintaining boiler plate code.
Used in production environments since 2012.
Configure the container by registering your components
ContainerBuilder builder;
builder.registerType< MessageDispatcher >();
auto container = builder.build();
... then ask the container to give you an instance of that type
auto dispatcher = container->resolve< MessageDispatcher >();
Want to discover what happened here? Learn to use more features through the beginner's guide on the wiki.
Some comparative benchmarks are available on the wiki, check them out.
Hypodermic was started with the will to mimic the famous .NET Autofac http://autofac.org/. Although its design evolved, both its behavior and its expressiveness tend to remain the same.
Constructor deduction has been made possible thanks to the work of Krzysztof Jusiak in http://boost-experimental.github.io/di/.
- without use boost
- introduce
sigslot::signal
- add
xmake
to build, also add an example, and it ignoresHypodermic.Tests
andcpack
. So, if you want build it with cmake, you should change correspondingcmakelist.txt
.