// // This file is part of dingo project // // See LICENSE for license and copyright information // SPDX-License-Identifier: MIT // #include #include #include int main() { using namespace dingo; //// struct A { A() = default; }; struct B { B(A &, std::shared_ptr) {} }; struct C { C(B *, std::unique_ptr &, A &) {} }; // Compile-time bindings declare the same storage and scope as runtime // registration. using app_bindings = bindings, storage>>, dingo::bind, storage>>, dingo::bind, storage>>; container container; // Resolution still uses the same API. C c = container.resolve(); struct D { A &a; B *b; }; // construct() and invoke() work with compile-time registration, too. D d = container.construct(); D e = container.invoke([&](A &a, B *b) { return D{a, b}; }); //// (void)c; (void)d; (void)e; }