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

Function app_module

example/tutorial/basic_split_your_configuration_expose.cpp:93–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93di::injector<app> app_module(const bool& use_gui_view) {
94 // clang-format off
95 return di::make_injector(
96 di::bind<iview>().to([&](const auto& injector) -> iview& {
97 if (use_gui_view)
98 return injector.template create<gui_view&>();
99 else
100 return injector.template create<text_view&>();
101 })
102 , di::bind<timer>().in(di::unique) // different per request
103 , di::bind<iclient*[]>().to<user, timer>() // bind many clients
104 , di::bind<int>().to(42) // renderer device
105 , di::bind<int>().to(123) [di::override] // override renderer device
106 , model_module()
107 );
108 // clang-format on
109}
110
111int main() {
112 auto use_gui_view = true;

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Calls 4

model_moduleFunction · 0.85
make_injectorFunction · 0.50
toMethod · 0.45
inMethod · 0.45

Tested by

no test coverage detected