di icon indicating copy to clipboard operation
di copied to clipboard

Runtime injector does not allow lazy binding to std::function factory methods

Open tripleslash opened this issue 3 years ago • 3 comments

Expected Behavior

Runtime injector does not allow binding to lambda callbacks

Actual Behavior

Steps to Reproduce the Problem

If you wrap the following code in a runtime_injector you will get a compiler error:

        auto ctInjector= boost::di::make_injector(
            boost::di::bind<IInterface>()
                    .to([](const auto& injector)
                    {
                        return injector.template create<Implementation>();
                    })
        );
        runtimeInjector.install(ctInjector);

Specifications

  • Version:
  • Platform:
  • Subsystem:

tripleslash avatar Oct 04 '21 15:10 tripleslash

Lots of things that work with normal injector does not work with runtime injector. I've got this problem too with it.

BpsTheCool avatar Oct 30 '21 13:10 BpsTheCool

That's true, runtime injector was just an experiment as an extension. but it seems to be popular, hence, let me improve the quality of it, sorry for the delay.

krzysztof-jusiak avatar Oct 30 '21 14:10 krzysztof-jusiak

Is there any plan to work on runtime injector? There haven't been any update.

BpsTheCool avatar Mar 10 '22 10:03 BpsTheCool