I have some code which effectively reduces to
#include <vector>
class A {
std::vector<int> m_sizes;
public:
A(std::initializer_list<int> const& sizes) : m_sizes(sizes) {}
};
class B {
A m_a;
public:
B(int size_front, int size_back, std::initializer_list<int> const& sizes) : m_a({ size_front, sizes, size_back }) {}
};
The compiler complains that no instance of A::A
matches the argument list.
Is there some way to flatten out the { int, std::initializer_list<int>, int }
to a std::initializer_list<int>
or do I have to give A
an extra constructor to handle this situation? What if I couldn't modify the A
class?