- 参考: https://qiita.com/kktk-KO/items/aad50e11e2aa84bce174#comment-65a5c36f4be828315ab8
- テストコード: https://wandbox.org/permlink/ccAavGVm03GU1vpC
#include <iostream>
#include <vector>
#include <list>
#include <initializer_list>
template <template <class...> class U = std::initializer_list, class E = int, class T = U<E>>
void f(T t)
{
for(auto x: t) {
std::cout << x << std::endl;
}
}
int main()
{
std::list<double> x { .1, .2, .3 };
auto y = { "hello", "c++", "world" };
f({1u, 2u, 3u});
f(x);
f(y);
}