0
这个问题部分解答了这里What does "typedef void (*Something)()" mean“typedef void(* task)()”是做什么的?
但是答案并不完全清楚。
如果我写
typedef void (*task)();
它是如何扩大?
thread_pool(unsigned int num_threads, task tbd) {
for(int i = 0; i < num_threads; ++i) {
the_pool.push_back(thread(tbd));
}
}
它会是这样吗?
thread_pool(unsigned int num_threads, (*task)() tbd) {
for(int i = 0; i < num_threads; ++i) {
the_pool.push_back(thread(tbd));
}
}
可能不是,因为它是一个语法错误。我希望你能为我解决问题。
代码示例从http://www.thesaguaros.com/openmp-style-constructs-in-c11.html
谢谢,现在它是有道理的。 – 2013-02-09 12:47:36