#include <iostream>
#include <thread>
template <int A> struct X
{
template <int B>
staticvoid function()
{
std::cout << "function\n";
}
};
int main(int argc, char **argv)
{
X<0>::function<1>(); // Compiles OK
std::thread(X<0>::function<1>).join(); // Error: invalid declaration of ‘X<0>::function<1>’|
return 0;
}
I tried many different combinations and googled a lot.
Just want to thread the static member function, any fix?
EDIT:
Providing an argument makes it work. Why? How can I avoid having to pass an argument?
EDIT2:
Well I fixed it myself using a lambda instead... Works for me, but still it'd be cleaner if it were possible to directly go through the thread's constructor. Oh well, this will do for now.