Everyone creates std::vector
from std::initializer_list
, but what about the other way around?
eg. if you use a std::initializer_list
I think that the best solution without templating obscure iterator classes for the good of passing vector using its two methods returning iterators is just to implement your function logic in a function taking vector.
void someThing(std::initializer_list items)
{
std::vector v;
for(int i:items)
{
v.push_back(i);
}
someThing(v);
}
void someThing(std::vector items)
{
...
}