Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'std::thread::thread': no overloaded function takes 7 arguments

Tags:

c++

I am using visual studio 2012 and the above error popups. My code is correct but seems like the compiler is limited to 7 arguments. What can I do If I want to pass 7 arguments?

I can pass a struct but better not change my code if possible.

like image 927
Luka Avatar asked Feb 11 '14 09:02

Luka


1 Answers

VS2012 does not fully support variadic templates. Also see this Blogpost: http://blogs.msdn.com/b/vcblog/archive/2011/09/12/10209291.aspx

You can set the maximum number of arguments as high as 10 by defining this Macro _VARIADIC_MAX.

So just do something like #define _VARIADIC_MAX 10.

The default values is 5, 2 standard argument + 5 variadic ones for std::thread. Overall you can pass as much as 12 parameters by settings the value above.

like image 151
Robin Avatar answered Sep 22 '22 10:09

Robin