Closed hellozyemlya closed 4 years ago
Yes, although the approach is not perfect (mostly due to C++ rigidness). Take a look at lazy
extension for example:
https://github.com/boost-experimental/di/blob/cpp14/extension/include/boost/di/extension/injections/lazy.hpp
Yeah, as @kanstantsin-chernik mentions, it's a bit clunky but you can do it with
struct ctor {
using boost_di_inject__ = inject<self<T>>;
template <class TInjector>
explicit ctor(const TInjector &);
};
Although, please be aware that ServiceLocator
is an anti-pattern and it's much better to inject dependencies instead :+1:
You can read more about it here -> https://boost-experimental.github.io/di/
Is that possible to inject injector?