#include <string>
#include <iostream>
void fun (const std::initializer_list<std::string>& strings) {
for(auto s : strings)
{
std::cout << s << " ";
}
}
template<typename ...Args>
void foo () {
fun({Args::value...});
}
struct A { static std::string value; };
struct B { static std::string value; };
struct C { static std::string value; };
struct D { static std::string value; };
std::string A::value = "Hello";
std::string B::value = "World";
std::string C::value = "of";
std::string D::value = "Variadic Templates";
int main()
{
foo<A, B, C, D>(); // where A, B, C, D are classes
}
ICAgICNpbmNsdWRlIDxzdHJpbmc+CiAgICAjaW5jbHVkZSA8aW9zdHJlYW0+CgogICAgdm9pZCBmdW4gKGNvbnN0IHN0ZDo6aW5pdGlhbGl6ZXJfbGlzdDxzdGQ6OnN0cmluZz4mIHN0cmluZ3MpIHsKICAgICAgICBmb3IoYXV0byBzIDogc3RyaW5ncykKICAgICAgICB7CiAgICAgICAgICAgIHN0ZDo6Y291dCA8PCBzIDw8ICIgIjsKICAgICAgICB9CiAgICB9CgogICAgdGVtcGxhdGU8dHlwZW5hbWUgLi4uQXJncz4KICAgIHZvaWQgZm9vICgpIHsKICAgICAgZnVuKHtBcmdzOjp2YWx1ZS4uLn0pOwogICAgfQoKICAgIHN0cnVjdCBBIHsgc3RhdGljIHN0ZDo6c3RyaW5nIHZhbHVlOyB9OwogICAgc3RydWN0IEIgeyBzdGF0aWMgc3RkOjpzdHJpbmcgdmFsdWU7IH07CiAgICBzdHJ1Y3QgQyB7IHN0YXRpYyBzdGQ6OnN0cmluZyB2YWx1ZTsgfTsKICAgIHN0cnVjdCBEIHsgc3RhdGljIHN0ZDo6c3RyaW5nIHZhbHVlOyB9OwoKICAgIHN0ZDo6c3RyaW5nIEE6OnZhbHVlID0gIkhlbGxvIjsKICAgIHN0ZDo6c3RyaW5nIEI6OnZhbHVlID0gIldvcmxkIjsKICAgIHN0ZDo6c3RyaW5nIEM6OnZhbHVlID0gIm9mIjsKICAgIHN0ZDo6c3RyaW5nIEQ6OnZhbHVlID0gIlZhcmlhZGljIFRlbXBsYXRlcyI7CgogICAgaW50IG1haW4oKQogICAgewogICAgICAgIGZvbzxBLCBCLCBDLCBEPigpOyAvLyB3aGVyZSBBLCBCLCBDLCBEIGFyZSBjbGFzc2VzCiAgICB9Cg==