我正在尝试将initializer_list作为可变参数模板的参数。但是我收到错误消息:could not deduce template argument for 'Types' from 'initializer-list'
有什么方法可以达到这个目的吗?
struct Struct {
int a, b;
};
template<typename Type, typename ...Types>
void func(vector<Type>, initializer_list<Struct> lists, Types... args) {
}
int main() {
vector<float> vec;
func(vec, { Struct{ 1, 2 } });
func(vec, { Struct{ 1, 2 } }, vec, { Struct{ 2, 2 } });
return 0;
}