// // Copyright (c) 2012-2020 Kris Jusiak (kris at jusiak dot net) // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // //<- #if !defined(_MSC_VER) //-> #include "boost/di/extension/injections/named_parameters.hpp" #include #include namespace di = boost::di; struct interface { virtual ~interface() = default; virtual void dummy() = 0; }; struct implementation : interface { void dummy() override {} }; struct example { /*<>*/ $inject(example, int i, std::unique_ptr up, [[named("my_value")]] int value) { assert(i == 42); assert(dynamic_cast(up.get())); assert(value == 87); } }; int main() { using namespace di::extension; // clang-format off /*<>*/ auto injector = di::make_injector( di::bind.to(42) , di::bind.to() , di::bind.named("my_value"_s).to(87) ); // clang-format on injector.create(); } //<- #else int main() {} #endif //->