Open Chaoses-Ib opened 2 years ago
di::make_injector(di::bind<A>().in(di::extension::shared))
has the same result.
After a year, I found a solution: change
class Class1 {
di::injector<di::extension::shared_config> injector;
public:
Class1() : injector(di::make_injector<di::extension::shared_config>());
};
to
class Class1 {
di::core::injector<di::extension::shared_config, di::core::pool_t<>> injector;
public:
Class1() : injector(di::make_injector<di::extension::shared_config>());
};
Expected Behavior
When the object where the injector resides is destroyed, the objects created in shared scope by the injector should also be destroyed.
Actual Behavior
Objects in shared scope are not destroyed on destructuring, but only at the end of the process.
Steps to Reproduce the Problem
Output:
Specifications