Skip to content

Resolving components

Yohan edited this page Oct 24, 2018 · 3 revisions

Foreword

Most of the time you won't need to actually call container->resolve< T >() by yourself since the container will do it for you automatically.

Resolve by type

auto object = container->resolve< T >();

object is a std::shared_ptr< T >.

Resolve by both type and name

auto lObject = container->resolveNamed< T >("lObject");

object is a std::shared_ptr< T >.

Resolve all components of a kind

auto objects = container->resolveAll< T >();

objects is a std::vector< std::shared_ptr< T > >.

Configuring the resolution behavior

Read this section to learn more about the runtime registration behavior.