result_of 模板类和using的关系?
小陆zi 2019-10-07 03:07:18 1:第一段代码来自GitHub :https://github.com/progschj/ThreadPool/blob/master/ThreadPool.h
using return_type = typename std::result_of<F(Args...)(args...)>::type;
auto task = std::make_shared< std::packaged_task<return_type()> >(
std::bind(std::forward<F>(f),std::forward<ARGS>(args)...)
);
return_type作为类型,还是函数调用体?functor()
在std::packaged_task<return_type()> 中使用了”()“,在return_type后面为什么加()?这是什么意思,告诉编译器什么信息?
2:自己写了以个函数
struct type{
using type_ = int;
};
int main()
{
type::type_ a; --------- 1
type::type_(); ----------2
return 0;
}
上面代码 1 和 2 有什么区别吗?
谢谢