How to configure and use the Hypodermic container
masterThe Hypodermic workflow relies on two primary classes: ContainerBuilder and the container instance returned by build().
Registration
Use ContainerBuilder::registerType<T>() to tell the container which types it is responsible for creating. This allows the container to understand how to instantiate T and satisfy its dependencies.
Resolution
Once the container is built, use the resolve<T>() method to obtain an instance of the requested type. The container will automatically handle the instantiation and dependency graph construction for T based on your registrations.
ContainerBuilder builder;
builder.registerType< MessageDispatcher >();
auto container = builder.build();
auto dispatcher = container->resolve< MessageDispatcher >();