boost-ext / di

C++14 Dependency Injection Library
https://boost-ext.github.io/di
1.13k stars 136 forks source link

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

Open tripleslash opened 2 years ago

tripleslash commented 2 years ago

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

BpsTheCool commented 2 years ago

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

krzysztof-jusiak commented 2 years ago

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.

BpsTheCool commented 2 years ago

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