* [Injector](#injector) * [di::make_injector](#di_make_injector) * [Bindings](#bindings) * [di::bind](#di_bind) * [Injections](#injections) * [automatic (default)](#di_automatic) * [BOOST_DI_INJECT](#BOOST_DI_INJECT) * [BOOST_DI_INJECT_TRAITS](#BOOST_DI_INJECT_TRAITS) * [di::inject](#di_inject) * [di::ctor_traits](#di_ctor_traits) * [Annotations](#annotations) * [(named = name)](#di_named) * [Scopes](#scopes) * [di::deduce (default)](#di_deduce) * [di::instance (di::bind<>.to(value))](#di_instance) * [di::singleton](#di_singleton) * [di::unique](#di_unique) * [Modules](#modules) * [BOOST_DI_EXPOSE](#BOOST_DI_EXPOSE) * [Providers](#providers) * [di::providers::stack_over_heap (default)](#di_stack_over_heap) * [di::providers::heap](#di_heap) * [Policies](#policies) * [di::policies::constructible](#di_constructible) * [Concepts](#concepts) * [di::concepts::boundable](#di_boundable) * [di::concepts::callable](#di_callable) * [di::concepts::configurable](#di_configurable) * [di::concepts::creatable](#di_creatable) * [di::concepts::providable](#di_providable) * [di::concepts::scopable](#di_scopable) * [Configuration](#configuration) * [di::config](#di_config) * [Implementation details](#implementation_details) --- [![Design](images/di.png)](images/di.png) | Component | Description | | ---------- | ----------- | | [Bindings](#bindings) | DSL to create dependencies representation which will be used by core to resolve types | | [Scopes](#scopes) | Responsible for maintain objects life time | | [Providers](#providers) | Responsible for providing object instance | | [Policies](#policies) | Compile-time limitations for types / Run-time types vistor | | [Config](#di_config) | Configuration for [Policies] and [Providers] | | Core | Responsible for resolving requested types (implementation detail) | | Wrappers | Responsible for conversion to required type (implementation detail) | --- Let's assume all examples below include `boost/di.hpp` header and define a convenient `di` namespace alias as well as some basic interfaces and types. ```cpp #include namespace di = boost::di; struct i1 { virtual ~i1() = default; virtual void dummy1() = 0; }; struct i2 { virtual ~i2() = default; virtual void dummy2() = 0; }; struct impl1 : i1 { void dummy1() override { } }; struct impl2 : i2 { void dummy2() override { } }; struct impl : i1, i2 { void dummy1() override { } void dummy2() override { } }; ``` ### Injector Injector is a core component providing types creation functionality using [bindings]. --- ***di::make_injector*** --- ***Header*** #include ***Description*** Creates [injector] type. ***Semantics*** template requires boundable class injector { public: using deps; // list of dependencies using config; // configuration injector(injector&&) = default; template // no requirements injector(core::injector&&) noexcept; explicit injector(const TDeps&...) noexcept; template injector& operator=(T&& other) noexcept; template requires creatable T create() const; }; | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `TDeps...` | [boundable] | [Bindings] to be used as configuration | - | | `create()` | [creatable] | Creates type `T` | `T` | | Type `T` | Is allowed? | Note | | -------- | ----------- | ---- | | `T` | ✔ | - | | `T*` | ✔ | Ownership transfer! | | `const T*` | ✔ | Ownership transfer! | | `T&` | ✔ | - | | `const T&` | ✔ | Reference with [singleton] / Temporary with [unique] | | `T&&` | ✔ | - | | `std::unique_ptr` | ✔ | - | | `std::shared_ptr` | ✔ | - | | `std::weak_ptr` | ✔ | - | | `boost_shared_ptr` | ✔ | - | template< class TConfig = di::config , class... TBindings > requires configurable && boundable auto make_injector(TBindings...) noexcept; | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `TConfig` | [configurable] | [Configuration] per [injector] | - | | `make_injector(TBindings...)` | [boundable] | Creates [injector] with given [Bindings] | [injector] | ***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/injector_empty.cpp) ***Example*** ![CPP(BTN)](Run_Hello_World_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/hello_world.cpp) ![CPP(BTN)](Run_Create_Objects_Tree_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/tutorial/basic_create_objects_tree.cpp)

**Injection in a nutshell** (implementation detail) The main interface of the injector is a `create` method. When `create` method is called for type `T` the magic happens. Firstly, policies are verified (for example, whether the type `T` is allowed to be created). Then, the constructor traits are deduced (`ctor_traits` ) for type `T` and dependencies of the constructor parameters are resolved (`binder`). `wrapper` is used to convert internal representation of the dependency into a required type (ex. `shared_ptr`). Whole process is repeated recursively for all required parameters of `T` constructor. ```cpp struct direct; // T(...) struct uniform; // T{...} template is_braces_constructible; // type T is constructible using T{...} template is_constructible; // Type T is constructible using T(...) template is_injectable; // Type T uses BOOST_DI_INJECT or BOOST_DI_INJECT_TRAITS template // For Example, TBindings = { di::bind.to } struct core::injector : TBindings... { using config = TConfig; using deps = TBindings...; template // For example, T = Interface auto create() const noexcept { TConfig::policies()...; // verify policies using Type = core::binder().resolve(*this); // Type = Implementation return core::wrapper{dependency.create(provider{*this}.get())}; } }; template struct provider { template auto get() const noexcept { using pair = decltype(ctor_traits()); return TConfig::provider().get(TInitialization{}, TCtor...); } const TInjector& injector; }; template struct any_type { template operator T() const { return injector.templte create(); } const TInjector& injector; }; template auto ctor_traits() { if (is_injectable() { return pair{}; // BOOST_DI_INJECT(T, args...) -> T(args...) } for (auto i = BOOST_DI_CFG_CTOR_LIMIT_SIZE; i >= 0; --i) { if (is_constructible...>()) { // ... -> i times return pair...>{}; // T(any_type...) } } for (auto i = BOOST_DI_CFG_CTOR_LIMIT_SIZE; i >= 0; --i) { if (is_braces_constructible...>()) { // ... -> i times return pair...>{}; // T{any_type...} } } return error(...); }; ``` **Note**

[Automatic injection](user_guide.md#di_automatic) depends on template implicit conversion operator and therefore conversion constructors `template T(I)` are not supported and have to be injected using [BOOST_DI_INJECT], [BOOST_DI_INJECT_TRAITS], [di::inject] or [di::ctor_traits].
--- ### Bindings Bindings define dependencies configuration describing what types will be created and what values will be passed into them. --- ***di::bind*** --- ***Header*** #include ***Description*** Allows to bind interface to implementation and associate value with it. ***Semantics*** struct override; // overrides given configuration namespace detail { template requires boundable struct bind { bind(bind&&) noexcept = default; template requires !is_array && boundable auto to() noexcept; template requires is_array && boundable auto to() noexcept; template requires boundable auto to(T&&) noexcept; template requires scopable auto in(const TScope& = di::deduce) noexcept; template // no requirements auto named(const TName& = {}) noexcept; auto operator[](const override&) noexcept; }; } // detail template requires boundable detail::bind bind{}; | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `I`, `Is...` | [boundable] | 'Interface' types | - | | `to` | [boundable] | Binds `I, Is...` to `T` type | [boundable] | | `to` | [boundable] | Binds `I, Is...` to `Ts...` type | [boundable] | | `to(T&&)` | [boundable] | Binds `I, Is...` to `T` object | [boundable] | | `in(const TScope&)` | [scopable] | Binds `I, Is...` in TScope` | [boundable] | | `named(const TName&)` | - | Binds `I, Is...` using [named] annotation | [boundable] | | `operator[](const override&)` | - | Overrides given binding | [boundable] | **Note**

Check out also [instance] scope to read more about binding to values: `di::bind<>.to(value)`.
| Expression | Description | | ---------- | ----------- | | **Multiple Interfaces** | | | `di::bind.to()` | Binds `Interface1, Interface2, ...` to `Implementation` using one object | | **Multiple Bindings** (std::array, std::vector, std::set) | | | `di::bind.to({1, 2, ...})` | Binds `int` to values `1, 2, ...` | | `di::bind.to()` | Binds `Interface` to `Implementation1, Implementation2, ...` | | **Dynamic Bindings** | | | `di::bind.to([](const auto& injector)`
` { return injector.template create()})` | Allows to bind `Interface` depending on a run-time condition | ***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/bind_interface_to_implementation.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/bind_type_to_value.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/bind_deduce_type_to_value.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/bind_type_to_compile_time_value.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/bind_multiple_interfaces.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/bind_dynamic_bindings.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/bind_multiple_bindings.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/bind_multiple_bindings_initializer_list.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/bind_type_override.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/bind_cross_platform.cpp) ***Example*** ![CPP(BTN)](Run_Bindings_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/bindings.cpp) ![CPP(BTN)](Run_Forward_Bindings_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/fwd_bindings.cpp) ![CPP(BTN)](Run_Dynamic_Bindings_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/dynamic_bindings.cpp) ![CPP(BTN)](Run_Multiple_Bindings_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/multiple_bindings.cpp) ![CPP(BTN)](Run_Constructor_Bindings_Extension|https://raw.githubusercontent.com/boost-ext/di/cpp14/extension/test/bindings/constructor_bindings.cpp)



### Injections *Constructor Injection* is the most powerful of available injections. It guarantees initialized state of data members. [Boost].DI constructor injection is achieved without any additional work from the user. --- ***automatic (default)*** --- ***Header*** #include ***Description*** [Boost].DI will deduce the best available constructor to be used for injection - unique constructor with the longest parameter list. If the default behavior should be changed constructor has to be explicitly marked with [BOOST_DI_INJECT] or [BOOST_DI_INJECT_TRAITS] or di::ctor_traits] or [di::inject]. **Note**

Automatic constructor parameters deduction is limited to [BOOST_DI_CFG_CTOR_LIMIT_SIZE], which by default is set to 10.
***Semantics*** class T { public: T(auto parameter1, auto parameter2, ..., auto parameterN); }; | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `parameter1-parameterN` | - | `N` constructor parameter | - | **Note**

[Boost].DI is not able to automatically distinguish between ambiguous constructors with the same (longest) number of parameters. Use [BOOST_DI_INJECT] or [BOOST_DI_INJECT_TRAITS] or [di::ctor_traits] or [di::inject] to explicitly mark constructor to be injected.
***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/constructor_injection_direct.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/constructor_injection_aggregate.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/constructor_injection_multiple_constructors.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/constructor_injection_ambiguous_constructors_via_vaargs.cpp) ***Example*** ![CPP(BTN)](Run_Automatic_Injection_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/automatic_injection.cpp) ![CPP(BTN)](Run_Constructor_Signature_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/constructor_signature.cpp) ![CPP(BTN)](Run_Lazy_Extension|https://raw.githubusercontent.com/boost-ext/di/cpp14/extension/test/injections/lazy.cpp) ![CPP(BTN)](Run_XML_Injection_Extension|https://raw.githubusercontent.com/boost-ext/di/cpp14/extension/test/injections/xml_injection.cpp)



--- ***BOOST_DI_INJECT*** --- ***Header*** #include ***Description*** BOOST_DI_INJECT is a macro definition used to explicitly say [Boost].DI which constructor should be used as well as to annotate types - see [annotations] for further reding. When class has more than one constructor [Boost].DI will by default choose the one with the longest parameter list. In case of constructors ambiguity, [Boost].DI is not able to choose the best one. Then BOOST_DI_INJECT becomes handy to point which constructor should be used. ***Semantics*** struct T { BOOST_DI_INJECT(T, ...) { } }; | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `T` | - | Class/Struct name | - | | `...` | - | `T` constructor parameters | - | **Note**

BOOST_DI_INJECT constructor parameters is limited to [BOOST_DI_CFG_CTOR_LIMIT_SIZE], which by default is set to 10.
***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/constructor_injection_ambiguous_constructors_via_BOOST_DI_INJECT.cpp) ***Example*** ![CPP(BTN)](Run_Constructor_Injection_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/constructor_injection.cpp) ![CPP(BTN)](Run_Concepts_Extension|https://raw.githubusercontent.com/boost-ext/di/cpp14/extension/test/injections/concepts.cpp)

--- ***BOOST_DI_INJECT_TRAITS*** --- ***Header*** #include ***Description*** BOOST_DI_INJECT_TRAITS is a macro definition used to define constructor traits. ***Semantics*** struct T { BOOST_DI_INJECT_TRAITS(...) { } T(...) { } }; | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `...` | - | `T` constructor parameters | - | **Note**

BOOST_DI_INJECT_TRAITS constructor parameters is limited to [BOOST_DI_CFG_CTOR_LIMIT_SIZE], which by default is set to 10.
***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/constructor_injection_ambiguous_constructors_via_BOOST_DI_INJECT_TRAITS.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/constructor_injection_default_values.cpp) ***Example*** ![CPP(BTN)](Run_Constructor_Injection_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/constructor_injection.cpp)

--- ***di::inject*** --- ***Header*** #include ***Description*** `di::inject` informs [Boost].DI about constructor parameters. It's useful for generated/generic classes as it doesn't have constructor parameters size limitations. ***Semantics*** struct T { using boost_di_inject__ = di::inject<...>; T(...) {} }; | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `...` | - | `T` constructor parameters | - | **Note**

`di::inject` has no limitations if it comes to constructor parameters, however, [named] parameters are not allowed. Moreover, you can replace `di::inject` with any variadic type list type to remove dependency to [Boost].DI. For example, `template struct type_list{};` `using boost_di_inject__ = type_list<...>;`
***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/constructor_injection_ambiguous_constructors_via_inject.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/constructor_injection_long_parameter_list.cpp) ***Example*** ![CPP(BTN)](Run_Constructor_Injection_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/constructor_injection.cpp)

--- ***di::ctor_traits*** --- ***Header*** #include ***Description*** `di::ctor_traits` is a trait in which constructor parameters for type `T` might be specified. It's useful for third party classes you don't have access to and which can't be created using [automatic] injection. ***Semantics*** namespace boost { namespace di { template <> struct ctor_traits { BOOST_DI_INJECT_TRAITS(...); // or using type = di::inject<...>; }; }} ***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/constructor_injection_ambiguous_constructors_via_ctor_traits.cpp) ***Example*** ![CPP(BTN)](Run_Constructor_Injection_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/constructor_injection.cpp)

### Annotations Annotations are type properties specified in order to refer to a type by the name instead of the type it self. They are useful when constructor has more than one parameter of the same type. For example, `T(int, int)`. --- ***(named = name)*** --- ***Header*** #include ***Description*** Named parameters are handy to distinguish different constructor parameters of the same type. ```cpp T(int value1, int value2); ``` In order to inject proper values into `value1` and `value2` they have to be differentiate somehow. [Boost].DI solution for this problem are annotations. **Note**

Annotations might be set only when constructor is marked using [BOOST_DI_INJECT] or [BOOST_DI_INJECT_TRAITS].
***Semantics*** auto Name = []{}; // just an object struct T { BOOST_DI_INJECT(T, (named = Name) type type_name [= default_value], ...); }; | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `Name` | - | Object representing named type | - | ***Example*** BOOST_DI_INJECT(T, (named = value_1) int value1, (named = value_2) int value2); **Note**

Implementation of constructor doesn't require annotations, only constructor definition requires them.
***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/annotated_constructor_injection.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/annotated_constructor_injection_with_constructor_definition.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/annotated_constructor_injection_with_ctor_traits.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/annotated_constructor_injection_with_the_same_names.cpp) ***Example*** ![CPP(BTN)](Run_Annotations_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/annotations.cpp) ![CPP(BTN)](Run_Named_Parameters_Extension|https://raw.githubusercontent.com/boost-ext/di/cpp14/extension/test/injections/named_parameters.cpp) ![CPP(BTN)](Run_Assisted_Injection_Extension|https://raw.githubusercontent.com/boost-ext/di/cpp14/extension/test/injections/assisted_injection.cpp)

### Scopes ***Header*** #include ***Description*** Scopes are responsible for creating and maintaining life time of dependencies. If no scope will be given, [deduce] scope will be assumed. ***Semantics*** template struct scope { template using is_referable; template static auto try_create(const TProvider&); template auto create(const TProvider&); }; | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `TExpected` | - | 'Interface' type | - | | `TGiven` | - | 'Implementation' type | - | | `is_referable` | - | Verifies whether scope value might be converted to a reference | true_type/false_type | | `try_create` | [providable] | Verifies whether type `T` might be created | true_type/false_type | | `create` | [providable] | Creates type `T` | `T` | | Type/Scope | [unique] | [singleton] | [instance] | |------------|----------|-------------|------------| | T | ✔ | - | ✔ | | T& | - | ✔ | ✔ | | const T& | ✔ (temporary) | ✔ | ✔ | | T* (transfer ownership) | ✔ | - | - | | const T* | ✔ | - | - | | T&& | ✔ | - | ✔ | | std::unique_ptr | ✔ | - | - | | std::shared_ptr | ✔ | ✔ | ✔ | | boost::shared_ptr | ✔ | ✔ | - / ✔ converted to | | std::weak_ptr | - | ✔ | - / ✔ converted to | ***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/scopes_custom.cpp) ***Example*** ![CPP(BTN)](Run_Custom_Scope_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/custom_scope.cpp) ![CPP(BTN)](Run_Scoped_Scope_Extension|https://raw.githubusercontent.com/boost-ext/di/cpp14/extension/test/scopes/scoped.cpp) ![CPP(BTN)](Run_Session_Scope_Extension|https://raw.githubusercontent.com/boost-ext/di/cpp14/extension/test/scopes/session.cpp) ![CPP(BTN)](Run_Shared_Scope_Extension|https://raw.githubusercontent.com/boost-ext/di/cpp14/extension/test/scopes/shared.cpp)



--- ***di::deduce (default)*** --- ***Header*** #include ***Description*** Default scope which will be converted to one of the scopes depending on the type. | Type | Scope | |------|-------| | T | [unique] | | T& | [singleton] | | const T& | [unique] (temporary) / [singleton] | | T* | [unique] (ownership transfer) | | const T* | [unique] (ownership transfer) | | T&& | [unique] | | std::unique_ptr | [unique] | | std::shared_ptr | [singleton] | | boost::shared_ptr | [singleton] | | std::weak_ptr | [singleton] | ***Semantics*** namespace scopes { struct deduce { template struct scope { template using is_referable; template static auto try_create(const TProvider&); template auto create(const TProvider&); }; }; } scopes::deduce deduce; | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `TExpected` | - | 'Interface' type | - | | `TGiven` | - | 'Implementation' type | - | | `is_referable` | - | Verifies whether scope value might be converted to a reference | true_type/false_type | | `try_create` | [providable] | Verifies whether type `T` might be created | true_type/false_type | | `create` | [providable] | Creates type `T` | `T` | ***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/scopes_deduce_default.cpp) ***Example*** ![CPP(BTN)](Run_Deduce_Scope_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/deduce_scope.cpp) ![CPP(BTN)](Run_Scopes_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/scopes.cpp)

--- ***di::instance (di::bind<>.to(value))*** --- ***Header*** #include ***Description*** Scope representing values - passed externally. The life time of the object depends on the user. [Boost].DI is not maintaining the life time of these objects, however, values and strings will be copied and managed by the library. | Type | instance[in] (`bind<>.to(in)`) | instance[out] (`injector.create()`) | | ---- | ------------ | ------------- | | T | ✔ | ✔ | | T& | ✔ | ✔ | | const T& | ✔ | ✔ | | T* | - | - | | const T* | - | - | | T&& | ✔ | ✔ | | std::unique_ptr | - | - | | std::shared_ptr | ✔ | ✔ | | boost::shared_ptr | - | ✔ | | std::weak_ptr | - | ✔ | ***Semantics*** namespace scopes { struct instance { template struct scope { template using is_referable; template static auto try_create(const TProvider&); template auto create(const TProvider&); }; }; } | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `TExpected` | - | 'Interface' type | - | | `TGiven` | - | 'Implementation' type | - | | `is_referable` | - | Verifies whether scope value might be converted to a reference | true_type/false_type | | `try_create` | [providable] | Verifies whether type `T` might be created | true_type/false_type | | `create` | [providable] | Creates type `T` | `T` | ***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/scopes_instance.cpp) ***Example*** ![CPP(BTN)](Run_Scopes_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/scopes.cpp) ![CPP(BTN)](Run_Bindings_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/bindings.cpp)

--- ***di::singleton*** --- ***Header*** #include ***Description*** Scope representing shared value between all instances as well as threads. Singleton scope will be deduced in case of reference, `std::shared_ptr`, `boost::shared_ptr` or `std::weak_ptr`. **Note**

Singleton scope will convert automatically between `std::shared_ptr` and `boost::shared_ptr` if required.
| Type | singleton | | ---- | --------- | | T | - | | T& | ✔ | | const T& | ✔ | | T* | - | | const T* | - | | T&& | - | | std::unique_ptr | - | | std::shared_ptr | ✔ | | boost::shared_ptr | ✔ | | std::weak_ptr | ✔ | ***Semantics*** namespace scopes { struct singleton { template struct scope { template using is_referable; template static auto try_create(const TProvider&); template auto create(const TProvider&); }; }; } scopes::singleton singleton; | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `TExpected` | - | 'Interface' type | - | | `TGiven` | - | 'Implementation' type | - | | `is_referable` | - | Verifies whether scope value might be converted to a reference | true_type/false_type | | `try_create` | [providable] | Verifies whether type `T` might be created | true_type/false_type | | `create` | [providable] | Creates type `T` | `T` | ***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/scopes_singleton.cpp) ***Example*** ![CPP(BTN)](Run_Scopes_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/scopes.cpp) ![CPP(BTN)](Run_Eager_Singletons_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/eager_singletons.cpp)

--- ***di::unique*** --- ***Header*** #include ***Description*** Scope representing unique/per request value. A new instance will be provided each time type will be requested. | Type | unique | | ---- | ------ | | T | ✔ | | T& | - | | const T& | ✔ (temporary) | | T* | ✔ (ownership transfer) | | const T* | ✔ (ownership transfer) | | T&& | ✔ | | std::unique_ptr | ✔ | | std::shared_ptr | ✔ | | boost::shared_ptr | ✔ | | std::weak_ptr | - | ***Semantics*** namespace scopes { struct unique { template struct scope { template using is_referable; template static auto try_create(const TProvider&); template auto create(const TProvider&); }; }; } scopes::unique unique; | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `TExpected` | - | 'Interface' type | - | | `TGiven` | - | 'Implementation' type | - | | `is_referable` | - | Verifies whether scope value might be converted to a reference | true_type/false_type | | `try_create` | [providable] | Verifies whether type `T` might be created | true_type/false_type | | `create` | [providable] | Creates type `T` | `T` | ***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/scopes_unique.cpp) ***Example*** ![CPP(BTN)](Run_Scopes_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/scopes.cpp)

### Modules ***Header*** #include ***Description*** Modules allow to split [bindings] configuration into smaller [injectors](#injector). Module might be installed by passing it into [make_injector]. ***Semantics*** auto module = di::make_injector(...); di::injector module = di::make_injector(...); | Expression | Description | Note | | ---------- | ----------- | ---- | | `auto module = di::make_injector(...)` | All types are exposed from `module` | `module.create()` is allowed for any `T` | | `di::injector module = di::make_injector(...)` | Only `Ts...` types are exposed from `module` | `module.create()` is allowed only for `T` <= `Ts...` | ***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/module.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/module_exposed_type.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/module_exposed_many_types.cpp) ***Example*** ![CPP(BTN)](Run_Modules_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/modules.cpp)

--- ***BOOST_DI_EXPOSE*** --- ***Header*** #include ***Description*** BOOST_DI_EXPOSE is a macro definition allowing to expose [named] parameters via module/[injector]. ***Semantics*** di::injector; | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `Name` | - | Named object | - | | `...` | - | More types to be exposed | - | ***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/module_exposed_annotated_type.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/module_exposed_complex_types.cpp) ***Example*** ![CPP(BTN)](Run_Modules_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/modules.cpp)

### Providers ***Header*** #include ***Description*** Providers are responsible for creating objects using given [Configuration]. ***Semantics*** namespace type_traits { struct direct; // T(...) struct uniform; // T{...} struct heap; // new T struct stack; // T } namespace providers { class provider { public: template struct is_creatable; template < class T , class TInit // type_traits::direct/type_traits::uniform , class TMemory // type_traits::heap/type_traits::stack , class... TArgs > auto get(const TInit&, const TMemory&, TArgs&&... args) const; }; } struct config : di::config { template static auto provider(const TInjector&) noexcept { return providers::stack_over_heap{}; } }; | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `TInjector` | - | [injector] | - | | `is_creatable` | [creatable] | Verify whether `T` is creatable with `TArgs...` | true_type/false_type | | `get(const TInit&, const TMemory&, TArgs&&...)` | `TInit` -> direct/uniform, `TMemory` -> heap/stack | Creates type `T` with `TArgs...` | `T` | **Note**

Provider used by [injector] might changed locally via [make_injector] or globally via [BOOST_DI_CFG].
***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/providers_heap_no_throw.cpp) ***Example*** ![CPP(BTN)](Run_Custom_Provider_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/custom_provider.cpp) ![CPP(BTN)](Run_Pool_Provider_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/pool_provider.cpp)

--- ***di::providers::stack_over_heap (default)*** --- ***Header*** #include ***Description*** Creates objects on the stack whenever possible, otherwise on the heap. ***Semantics*** namespace providers { class stack_over_heap { public: template struct is_creatable; template < class T , class TInit // type_traits::direct/type_traits::uniform , class TMemory // type_traits::heap/type_traits::stack , class... TArgs > auto get(const TInit&, const TMemory&, TArgs&&... args) const; }; } | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `is_creatable` | [creatable] | Verify whether `T` is creatable with `TArgs...` | true_type/false_type | | `get(const TInit&, const TMemory&, TArgs&&...)` | `TInit` -> direct/uniform, `TMemory` -> heap/stack | Creates type `T` with `TArgs...` | `T` | | Type | `TMemory` | |------|-------| | T | stack | | T& | stack | | const T& | stack | | T&& | stack | | T* | heap | | const T* | heap | | std::unique\_ptr | heap | | std::shared\_ptr | heap | | std::weak\_ptr | heap | | boost::shared\_ptr | heap | | `is_polymorphic` | heap | ***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/providers_stack_over_heap.cpp) ***Example*** ![CPP(BTN)](Run_Custom_Provider_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/custom_provider.cpp) ![CPP(BTN)](Run_Pool_Provider_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/pool_provider.cpp)

--- ***di::providers::heap*** --- ***Header*** #include ***Description*** Basic provider creates objects on the heap (always). ***Semantics*** namespace providers { class heap { public: template struct is_creatable; template < class T , class TInit // type_traits::direct/type_traits::uniform , class TMemory // type_traits::heap/type_traits::stack , class... TArgs > auto get(const TInit&, const TMemory&, TArgs&&... args) const; }; } | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `is_creatable` | [creatable] | Verify whether `T` is creatable with `TArgs...` | true_type/false_type | | `get(const TInit&, const TMemory&, TArgs&&...)` | `TInit` -> direct/uniform, `TMemory` -> heap/stack | Creates type `T` with `TArgs...` | `T` | ***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/providers_heap_no_throw.cpp) ***Example*** ![CPP(BTN)](Run_Custom_Provider_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/custom_provider.cpp) ![CPP(BTN)](Run_Pool_Provider_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/pool_provider.cpp) ![CPP(BTN)](Run_Mocks_Provider_Extension|https://raw.githubusercontent.com/boost-ext/di/cpp14/extension/test/providers/mocks_provider.cpp)



### Policies ***Header*** #include ***Description*** Policies operates on dependencies in order to limit allowed behaviour or visit created types during run-time. Policies are set up via [Configuration]. **Note**

By default [Boost].DI has NO policies enabled.
***Semantics*** template requires callable auto make_policies(TPolicies...) noexcept; struct config : di::config { template static auto policies(const TInjector&) noexcept { return make_policies(...); } }; | | // policy / template <----------------------------------------------------- void operator()(const T&); | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `TInjector` | - | [injector] | - | | `make_policies` | [callable] | Creates policies | [callable] list | | `T` | Description | Example | | --- | ----------- | ------- | | `T::type` | Type to be created | `std::shared_ptr` | | `T::expected` | Decayed 'Interface' type | `interface` | | `T::given` | Decayed 'Given' type | `implementatoin` | | `T::name` | Annotation name | `my_name` | | `T::arity` | Number of constructor arguments | `integral_constant` | | `T::scope` | [scope](#scopes) | [singleton] | | `T::is_root` | Is the root object (a type `create` was called with) | `true_type`/`false_type` | **Note**

In order for injector to verify policies they have to be created using [config] and passed via `TConfig` in [make_injector] or set it globally via [BOOST_DI_CFG].
***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/policies_print_types.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/policies_print_type_extended.cpp) ***Example*** ![CPP(BTN)](Run_Custom_Policy_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/custom_policy.cpp) ![CPP(BTN)](Run_Types_Dumper_Extension|https://raw.githubusercontent.com/boost-ext/di/cpp14/extension/test/policies/types_dumper.cpp) ![CPP(BTN)](Run_UML_Dumper_Extension|https://raw.githubusercontent.com/boost-ext/di/cpp14/extension/test/policies/uml_dumper.cpp)



--- ***di::policies::constructible*** --- ***Header*** #include ***Description*** Constructible policy limits constructor parameters to explicitly allowed. **Note**

By default constructible policy disables creation of any constructor parameters.
***Semantics*** namespace policies { struct _ { }; // placeholder static constexpr auto include_root = true; template struct is_root; // true when is the root type (`create()`) template struct is_bound; // true when type is bound with 'di::bind' template struct is_injected; // true when type is injected using 'BOOST_DI_INJECT' or is 'fundamental' template auto constructible(const T&) noexcept; } namespace operators { template inline auto operator!(const X&) template inline auto operator&&(const X&, const Y&); template inline auto operator||(const X&, const Y&); } | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `is_root` | - | Verify whether type `T` is a root type | true_type/false_type | | `is_bound` | - | Verify whether type `T` is bound | true_type/false_type | | `is_injected` | - | Verify whether type `T` is injected via [BOOST_DI_INJECT] | true_type/false_type | **Note**

In order to allow logic operators using namespace `boost::di::policies::operators` has to be used.
***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/policies_constructible_local.cpp) ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/policies_constructible_global.cpp) **Note**

STL type traits are supported and might be combined with [Boost].DI traits in order to limit constructor types For example, `std::is_same<_, int>{} || std::is_constructible<_, int, int>{} || std::is_base_of{}`, etc...
***Example*** ![CPP(BTN)](Run_Custom_Policy_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/custom_policy.cpp) ![CPP(BTN)](Run_Types_Dumper_Extension|https://raw.githubusercontent.com/boost-ext/di/cpp14/extension/test/policies/types_dumper.cpp) ![CPP(BTN)](Run_UML_Dumper_Extension|https://raw.githubusercontent.com/boost-ext/di/cpp14/extension/test/policies/uml_dumper.cpp)



### Concepts Concepts are types constraints which ensure that only given types which are satisfied by the constraint will be allowed. If type doesn't satisfy the concept short and descriptive error message is provided. --- ***di::concepts::boundable*** --- ***Header*** #include ***Description*** [Bindings] type requirement. ***Synopsis*** template concept bool boundable() { return is_complete() && is_complete() && (is_base_of() || is_convertible()); } template concept bool boundable() { return is_supported()... && is_movable()... && (is_base_of()... || is_base_of()...); } ***Semantics*** boundable boundable | Expression | Description | Returns | | ---------- | ----------- | ------- | | `Ts...` | Bindings to be verified | true_type if constraint is satisfied, `Error` otherwise | ***Example*** | Error | `type::has_disallowed_qualifiers` | | ---------- | ----------- | | Description | type `T` has disallowed qualifiers | | Expression | ![CPP](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/errors/boundable_type_has_disallowed_qualifiers.cpp) | | Error | `type::is_abstract` | | ---------- | ----------- | | Description | type `T` is abstract | | `BOOST_DI_CFG_DIAGNOSTICS_LEVEL` | 0, 1 -> no additional info, 2 -> info about why type `T` is abstract | | Expression | ![CPP](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/errors/boundable_type_is_abstract.cpp) | | Error | `type::is_not_related_to` | | ---------- | ----------- | | Description | type `T` is not related to type `U` | | Expression | ![CPP](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/errors/boundable_type_is_not_related_to.cpp) | | Error | `type::is_bound_more_than_once` | | ---------- | ----------- | | Description | type `T` is bound more than once | | Expression | ![CPP](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/errors/boundable_type_is_bound_more_than_once.cpp) | | Error | `type::is_neither_a_dependency_nor_an_injector` | | ---------- | ----------- | | Description | type `T` is neither a dependency nor an injector | | Expression | ![CPP](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/errors/boundable_type_is_neither_a_dependency_nor_an_injector.cpp) | --- --- ***di::concepts::callable*** --- ***Header*** #include ***Description*** [Policy] type requirement. ***Synopsis*** template concept bool callable() { return requires(T object) { { object(...) }; } } ***Semantics*** callable ***Example*** | Error | `policy::requires_` | | ---------- | ----------- | | Description | policy `TPolicy` requires a call operator | | Expression | ![CPP](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/errors/callable_requires_call_operator.cpp) | --- --- ***di::concepts::configurable*** --- ***Header*** #include ***Description*** [Configuration] type requirement. ***Synopsis*** template concept bool configurable() { return requires(T object) { return providable && callable(); } } ***Semantics*** configurable ***Example*** | Error | `config::requires_>` | | ---------- | ----------- | | Description | config `T` requires only providable and callable types | | Expression | ![CPP](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/errors/configurable_requires_callable_and_providable.cpp) | --- --- ***di::concepts::creatable*** --- ***Header*** #include ***Description*** Requirement for type `T` which is going to be created via [injector]`.create()` ***Synopsis*** namespace type_traits { template using ctor_traits; // returns list of constructor parameters } template concept bool creatable() { return is_constructible() && is_constructible...>(); } ***Semantics*** creatable ***Example*** | Error | `abstract_type::is_not_bound` | | ---------- | ----------- | | Description | abstract type `T` is not bound | | `BOOST_DI_CFG_DIAGNOSTICS_LEVEL` | 0 -> 'constraint not satisfied', 1 -> (0) + abstract type is not bound, 2 -> (1) + creation tree | | Suggestion | 'type is not bound, did you forget to add: 'di::bind.to()'?' | | Expression | ![CPP](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/errors/creatable_abstract_type_is_not_bound.cpp) | | Expression | ![CPP](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/errors/creatable_expose_abstract_type_is_not_bound.cpp) | | Error | `type::has_ambiguous_number_of_constructor_parameters::given::expected` | | ---------- | ----------- | | Description | type `T` has ambiguous number of constructor parameters where `Given` were provided but `Expected` were expected | | `BOOST_DI_CFG_DIAGNOSTICS_LEVEL` | 0 -> 'constraint not satisfied', 1 -> (0) + abstract type is not bound, 2 -> (1) + creation tree | | Suggestion | 'verify BOOST_DI_INJECT_TRAITS or di::ctor_traits' | | Expression | ![CPP](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/errors/creatable_type_has_ambiguous_number_of_constructor_parameters.cpp) | | Error | `type::has_to_many_constructor_parameters::max` | | ---------- | ----------- | | Description | type `T` has to many constructor parameter where maximum number is `Max` | | `BOOST_DI_CFG_DIAGNOSTICS_LEVEL` | 0 -> 'constraint not satisfied', 1 -> (0) + abstract type is not bound, 2 -> (1) + creation tree | | Suggestion | 'increase BOOST_DI_CFG_CTOR_LIMIT_SIZE value or reduce number of constructor parameters' | | Expression | ![CPP](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/errors/creatable_type_has_to_many_constructor_parameters.cpp) | | Error | `scoped::is_not_convertible_to` | | ---------- | ----------- | | Description | scope `TScope` is not convertible to type `T` | | `BOOST_DI_CFG_DIAGNOSTICS_LEVEL` | 0 -> 'constraint not satisfied', 1 -> (0) + abstract type is not bound, 2 -> (1) + creation tree | | Suggestion | 'scoped object is not convertible to the requested type, did you mistake the scope: 'di::bind.in(scope)'?' | | Expression | ![CPP](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/errors/creatable_scoped_is_not_convertible_to.cpp) | | Error | `scoped::is_not_convertible_to` | | ---------- | ----------- | | Description | instance is not convertible to type `T` | | `BOOST_DI_CFG_DIAGNOSTICS_LEVEL` | 0 -> 'constraint not satisfied', 1 -> (0) + abstract type is not bound, 2 -> (1) + creation tree | | Suggestion | 'instance is not convertible to the requested type, verify binding: 'di::bind.to(value)'?' | | Expression | ![CPP](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/errors/creatable_instance_is_not_convertible_to.cpp) | **Note**

Suggestions are not supported/displayed by MSVC-2015.
--- --- ***di::concepts::providable*** --- ***Header*** #include ***Description*** [Provider] type requirement. ***Synopsis*** namespace type_traits { struct direct; struct uniform; struct stack; struct heap; } template concept bool providable() { return requires(T object) { { object.template get<_>(type_traits::direct/type_traits::uniform{}, type_traits::stack/type_traits::heap{}, ...) }; { object.template is_creatable<_>(type_traits::direct/type_traits::uniform{}, type_traits::stack/type_traits::heap{}, ...) }; } } ***Semantics*** providable ***Example*** | Error | `provider::requires_` | | ---------- | ----------- | | Description | provider `TProvider` requires `get` method | | Expression | ![CPP](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/errors/providable_requires_get.cpp) | --- --- ***di::concepts::scopable*** --- ***Header*** #include ***Description*** [Scope] type requirement. ***Synopsis*** struct _ {}; // any type template concept bool scopable() { return requires(T) { typename scope<_, _>::is_referable; { T::scope<_, _>{}.try_create() }; { T::scope<_, _>{}.create() }; } } ***Semantics*** scopable ***Example*** | Error | `scope::requires_` | | ---------- | ----------- | | Description | scope `TScope` requires `create` method | | Expression | ![CPP](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/errors/scopable_requires_create.cpp) | --- ### Configuration --- ***di::config*** --- ***Header*** #include ***Description*** [Injector] configuration. ***Synopsis*** struct config { static auto provider(...) noexcept; static auto policies(...) noexcept; }; | Expression | Requirement | Description | Returns | | ---------- | ----------- | ----------- | ------- | | `provider()` | [providable] | Creates provider | [providable] | | `policies()` | [callable] | Creates policies | [callable] | | Expression | Description | | ---------- | ----------- | | `BOOST_DI_CFG` | Global configuration allows to customize provider and policies | ***Semantics*** di::make_injector(...) // or #define BOOST_DI_CFG config // change default di::make_injector(...) ***Test*** ![CPP(SPLIT)](https://raw.githubusercontent.com/boost-ext/di/cpp14/example/user_guide/policies_constructible_global.cpp) ***Example*** ![CPP(BTN)](Run_Configuration_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/configuration.cpp) ![CPP(BTN)](Run_Custom_Policy_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/custom_policy.cpp) ![CPP(BTN)](Run_Custom_Provider_Example|https://raw.githubusercontent.com/boost-ext/di/cpp14/example/custom_provider.cpp)

[Bindings]: #bindings [bindings]: #bindings [annotations]: #annotations [boundable]: #di_boundable [callable]: #di_callable [configurable]: #di_configurable [creatable]: #di_creatable [providable]: #di_providable [scopable]: #di_scopable [automatic]: #di_automatic [di::inject]: #di_inject [di::ctor_traits]: #di_ctor_traits [injector]: #di_make_injector [Injector]: #di_make_injector [make_injector]: #di_make_injector [Configuration]: #di_config [Policy]: #policies [Provider]: #providers [Scope]: #scopes [deduce]: #di_deduce [instance]: #di_instance [singleton]: #di_singleton [unique]: #di_unique [named]: #di_named [config]: #di_config [BOOST_DI_CFG]: #di_config [BOOST_DI_INJECT]: #BOOST_DI_INJECT [BOOST_DI_INJECT_TRAITS]: #BOOST_DI_INJECT_TRAITS [BOOST_DI_CFG_CTOR_LIMIT_SIZE]: overview.md#configuration [BOOST_DI_CFG_DIAGNOSTICS_LEVEL]: overview.md#configuration [di::inject]: #di_inject [di::ctor_traits]: #di_ctor_traits [BOOST_DI_INJECT]: #BOOST_DI_INJECT [BOOST_DI_INJECT_TRAITS]: #BOOST_DI_INJECT_TRAITS