Apparently there’s a maximum number of arguments for std::thread for the std::thread implementation in the current MSVC 2012 RC.
This code compiles fine with both MSVC and g++ with -std=c++0x:
std::thread t = std::thread(printf, "%d, %d, %d, %d", 1, 2, 3, 4);
t.join();
But for more than 6 arguments, MSVC returns an error:
std::thread t = std::thread(printf, "%d, %d, %d, %d, %d", 1, 2, 3, 4, 5);
t.join();
error C2661: ‘std::thread::thread’ : no overloaded function takes 7
arguments
Is this somehow intended? Or maybe a bug in the MSVC implementation? Is it because there’s no support for variadic templates in MSVC yet?
MSVC2010 does not have variadic templates so they’re implemented with the help of the preprocessor.
I think you can set a
#defineto set the number of arguments supported. I can check later, when i’m back at home, which one it is.EDIT:
I just realized this is about 2012 version. As can bee read in VS connect bug report it still does not support variadic templates.