首页 > 其他 > 详细

auto function -> return type 当不能从{}内推断类型时

时间:2018-05-23 19:43:16      阅读:310      评论:0      收藏:0      [点我收藏+]

示例:

1 template<class F, class... Args>
2 auto ThreadPool::enqueue(F&& f, Args&&... args)
3 -> std::future<typename std::result_of<F(Args...)>::type>

result_of可以推断函数F(Args...)的返回值类型,

auto ->表明函数返回类型为std::future<typename std::result_of<F(Args...)>::type>

auto function -> return type 当不能从{}内推断类型时

原文:https://www.cnblogs.com/zl1991/p/9078300.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!