You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am encountering an issue where a lambda expression used to conditionally bind an array of interfaces (Log) based on runtime conditions is not being executed. This problem arises when using boost::di to manage dependency injection where the lambda is supposed to dynamically decide the creation of different implementations (ConsoleLog, FileLog) of the Log interface. Despite configuring the injector correctly, the lambda expression doesn't seem to be invoked at all.
Here is my code :
Attempts to Resolve
Direct Call Test: Attempted to directly call the lambda by manually invoking the creation of the std::vector<std::shared_ptr> to ensure it's not an issue with how the lambda is set up.
Simplification: Reduced the complexity of the lambda to just create a single instance of ConsoleLog without any conditions to check if the lambda gets called.
Logging: Added extensive logging inside the lambda and around its invocation to track execution flow and verify whether the lambda is invoked.
Current Status
Despite these attempts, the lambda expression does not execute, and the injector seems to not resolve the dependencies as expected. The logging statements inside the lambda ("Lambda executing") are never printed, indicating that the lambda is not being triggered at all.
Request for Assistance
I am looking for guidance on whether there is a configuration mistake or a misunderstanding on my part regarding how boost::di manages lambda expressions for dependency injection. Any advice or insights into what might be causing this issue or how to resolve it would be greatly appreciated.
The text was updated successfully, but these errors were encountered:
I am encountering an issue where a lambda expression used to conditionally bind an array of interfaces (Log) based on runtime conditions is not being executed. This problem arises when using boost::di to manage dependency injection where the lambda is supposed to dynamically decide the creation of different implementations (ConsoleLog, FileLog) of the Log interface. Despite configuring the injector correctly, the lambda expression doesn't seem to be invoked at all.
Here is my code :
Attempts to Resolve
Direct Call Test: Attempted to directly call the lambda by manually invoking the creation of the std::vector<std::shared_ptr> to ensure it's not an issue with how the lambda is set up.
Simplification: Reduced the complexity of the lambda to just create a single instance of ConsoleLog without any conditions to check if the lambda gets called.
Logging: Added extensive logging inside the lambda and around its invocation to track execution flow and verify whether the lambda is invoked.
Current Status
Despite these attempts, the lambda expression does not execute, and the injector seems to not resolve the dependencies as expected. The logging statements inside the lambda ("Lambda executing") are never printed, indicating that the lambda is not being triggered at all.
Request for Assistance
I am looking for guidance on whether there is a configuration mistake or a misunderstanding on my part regarding how boost::di manages lambda expressions for dependency injection. Any advice or insights into what might be causing this issue or how to resolve it would be greatly appreciated.
The text was updated successfully, but these errors were encountered: