Questions tagged «result-of»

2
std :: result_of和decltype之间的区别
我在理解std::result_ofC ++ 0x 的需求时遇到了一些麻烦。如果我理解正确,result_of它用于获得使用某些类型的参数调用函数对象的结果类型。例如: template <typename F, typename Arg> typename std::result_of<F(Arg)>::type invoke(F f, Arg a) { return f(a); } 我看不出以下代码有什么区别: template <typename F, typename Arg> auto invoke(F f, Arg a) -> decltype(f(a)) //uses the f parameter { return f(a); } 要么 template <typename F, typename Arg> auto invoke(F f, Arg …
100 c++  c++11  decltype  result-of 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.