6
C++调用std::thread(f,param),两个形参会被推导为什么类型?
source link: https://www.zhihu.com/question/449953517/answer/1786290990
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
C++调用std::thread(f,param),两个形参会被推导为什么类型? - 知乎
登录一下,更多精彩内容等你发现
贡献精彩回答,参与评论互动
std::thread
的构造函数是个泛型函数:
template< class Function, class... Args >
explicit thread( Function&& f, Args&&... args );
也就是说第一个参数为函数对象类型,第二个为函数对象的入参类型,这些都是泛型。总的来说取决于你传递的f
与param
的实际类型。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK