I play with C++0x for some time and now I want to use variadic templates and tuple to implement class \"Task\". I\'m going to pass Task objects into newly created threads (u
It should be equivalent, but the only way to be sure is to test with the compiler you are using.
Note that you could use std::function with std::bind instead, e.g. something like:
template class Task : public TaskCaller
{
std::function functor;
public:
Task (bool (*func)(T_arguments&...), T_arguments... arguments)
: functor(std::bind(func, arguments...))
{}
bool dispatch() {
return functor();
}
// ...
Or better yet, let the user pass a std::function in:
class Task : public TaskCaller {
std::function functor;
public:
Task(std::function func) : functor(func) {}
// ...
That allows the user to choose what to pass instead of forcing him to use free functions or static member functions.