Closed lisongmin closed 6 years ago
Thanks, @lisongmin. The problem is that in the newest libstdc++ the queue constructor with the longest list of parameters is ambiguous; hence [Boost].DI can't deduce it properly.
It used to work fine in gcc-5.4 with older libstdc++ -> https://godbolt.org/g/vAbWWS
The easiest solution is to explicitly define what the queue ctor looks like by using ctor_traits
BOOST_DI_NAMESPACE_BEGIN
template <class T>
struct ctor_traits<std::queue<T>> {
using boost_di_inject__ = di::inject<>; // use default ctor unless DI should inject something else
};
BOOST_DI_NAMESPACE_END
Full example here -> https://godbolt.org/g/QceQPi
Expected Behavior
injector.create can create std::queue instance.
Actual Behavior
can not compile.
Steps to Reproduce the Problem
minimal code to reproduce this problem:
compile with
g++ -std=c++17
option.Specifications