List initialization is only available since C++11. Passing a braced init list as a function argument tries to list initialize the corresponding argument. Thus, any type which can be list initialized would be a valid argument type for your case. In particular, aggregate types, initializer_list
-constructible types and types with a constructor matching the types in the braced init list(non-narrowing conversions only) would work.
Here are a few possible signatures for doSomething
:
void doSomething(initializer_list<int>);
void doSomething(vector<int>);
struct Agg
{
int a,b,c,d,e;
};
void doSomething(Agg);
struct Constructible
{
Constructible(int, int, int, int, int);
};
void doSomething(Constructible);