Closed Toinouze closed 6 years ago
Try:
const auto injector = boost::di::make_injector(
boost::di::bind<>.to(myTParam)
);
Right, bind can't have any qualifiers. It's by design to avoid binding all possible combinations (T, const T, volatile T*, T&, const T&, etc.). Instead, DI is taking care of the possible conversions (in your case from an instance).
Pointers, in general, are tricky as they can be owned or not. To avoid confusion DI takes non-owning references instead.
I think that https://github.com/boost-experimental/di/blob/cpp14/example/bind_non_owning_ptr.cpp is an example which is solving a similar problem.
Expected Behavior
should work
Actual Behavior
Gives error
type_<T *>::has_disallowed_qualifiers>
Specifications