-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
27 lines (22 loc) · 715 Bytes
/
Copy pathmain.cpp
File metadata and controls
27 lines (22 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <functional>
import ddge.prelude;
struct First {
int value{ 42 };
};
struct Second {
std::reference_wrapper<const int> ref;
};
auto main() -> int
{
const int result = ddge::app::create()
.plug_in(ddge::resources::Plugin{})
.insert_resource(First{})
.inject_resource([](const First& first) -> Second {
return Second{ .ref = first.value };
})
.plug_in(ddge::app::RunnablePlugin{})
.run([](auto app) -> int {
return app.resource_manager.template at<Second>().ref.get();
});
return result;
}