【发布时间】:2013-01-25 03:28:28
【问题描述】:
这个问题在这里得到了部分回答What does "typedef void (*Something)()" mean
但答案对我来说并不完全清楚。
如果我写
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
【问题讨论】: