This is the simplified code:
#include <vector>
class VInitList
{
public:
explicit VInitList(std::vector<int> v){}
};
int main()
{
VInitList vil({{}});
}
and compiling with g++ 5.2.1 a get this error:
error: call of overloaded ‘VInitList(<brace-enclosed initializer list>)’ is ambiguous
VInitList vil({{}});
^
main.cpp:6:5: note: candidate: VInitList::VInitList(std::vector<int>)
VInitList(std::vector<int> v){}
^
main.cpp:3:7: note: candidate: constexpr VInitList::VInitList(const VInitList&)
class VInitList
^
main.cpp:3:7: note: candidate: constexpr VInitList::VInitList(VInitList&&)
When I saw the compiler error I found out that I have written {{}} by mistake (yeah, don't be mean to me), but I still cannot understand the error. IMHO either the compiler must get rid of the extra {} or return a syntax error.
Then I tried to compile this:
std::vector<int> v = {{{}}};
which works as intended.
{}are enough in both the cases. The contained type isint, why to complicate? :-)