MCPcopy Create free account
hub / github.com/boost-ext/di / main

Function main

example/user_guide/annotated_constructor_injection.cpp:23–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21};
22
23int main() {
24 // clang-format off
25 auto injector = di::make_injector(
26 di::bind<int>().named(int1).to(42)
27 , di::bind<int>().named(int2).to(87)
28 );
29 // clang-format on
30 {
31 auto object = injector.create<T>();
32 assert(42 == object.a);
33 assert(87 == object.b);
34 }
35 {
36 auto object = T(42, 87);
37 assert(42 == object.a);
38 assert(87 == object.b);
39 }
40}

Callers

nothing calls this directly

Calls 4

TClass · 0.70
make_injectorFunction · 0.50
toMethod · 0.45
namedMethod · 0.45

Tested by

no test coverage detected