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

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -