// // 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) // //<- #include #include #include namespace di = boost::di; struct i1 { virtual ~i1() noexcept = default; virtual void dummy1() = 0; }; struct impl1 : i1 { void dummy1() override {} }; //-> int main() { auto injector = di::make_injector( #if defined(__cpp_variable_templates) di::bind.to() #else di::bind().to() // no variable templates #endif ); auto object = injector.create>(); assert(dynamic_cast(object.get())); }