// // 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 //-> class all_must_be_bound_unless_int; #define BOOST_DI_CFG all_must_be_bound_unless_int #include //<- namespace di = boost::di; //-> class all_must_be_bound_unless_int : public di::config { public: static auto policies(...) noexcept { using namespace di::policies; using namespace di::policies::operators; return di::make_policies(constructible(std::is_same{} || is_bound{})); } }; int main() { assert(0 == di::make_injector().create()); // di::make_injector().create(); // compile error assert(42.0 == make_injector(di::bind().to(42.0)).create()); }