c++ - How to use template when number of arguments are not known? -
i have refered link meet requirement . when trying implement same in code, throwing error.
template<typename t, typename... args> void fun(t t, args... args) { cout << t; } int main() { fun(1, 2.0, "ranjan", "hi");//error happens here return 0; } the error @ fun() template<class t, <error type>>
what going wrong here?
vs2010 not support variadic templates. see c++11 features. vs2012 not support either, according page, upgrading not solution @ moment.
search c++03 mimic variadic templates determine if there alternative (one example site: how implement "variadic template" pre-c++0x(vs2008)?).
Comments
Post a Comment