We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
di.hpp should not cause compilation errors or inject empty vectors
boost::di::bind<Base*[]>().to({std::make_shared<Derived>(1), std::make_shared<Derived>(2)}) -> cannot pass initializer list to variadic method compilation error
boost::di::bind<Base*[]>().to({std::make_shared<Derived>(1), std::make_shared<Derived>(2)})
boost::di::bind<Base*[]>().to(vec) -> an empty vector is injected
boost::di::bind<Base*[]>().to(vec)
#include <iostream> #include "di.hpp" struct Base { }; struct Derived : Base { explicit Derived(const int integer) { std::cout << integer << std::endl; } }; struct Test { explicit Test(std::vector<std::shared_ptr<Base>> vec) { std::cout << vec.size() << std::endl; } }; int main() { std::vector<std::shared_ptr<Base>> vec{std::make_shared<Derived>(1), std::make_shared<Derived>(2)}; const auto injector = boost::di::make_injector( // boost::di::bind<Base *[]>().to({std::make_shared<Derived>(1), std::make_shared<Derived>(2)}), boost::di::bind<Base *[]>().to(vec)); std::ignore = injector.create<Test>(); return 0; }
Am I doing something wrong? Is there any alternative to get what I need?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Expected Behavior
di.hpp should not cause compilation errors or inject empty vectors
Actual Behavior
boost::di::bind<Base*[]>().to({std::make_shared<Derived>(1), std::make_shared<Derived>(2)})
-> cannot pass initializer list to variadic method compilation errorboost::di::bind<Base*[]>().to(vec)
-> an empty vector is injectedSteps to Reproduce the Problem
Am I doing something wrong? Is there any alternative to get what I need?
Specifications
The text was updated successfully, but these errors were encountered: