decltype

    82熱度

    2回答

    我在理解C++ 0x中需要std::result_of時遇到了一些麻煩。如果我理解正確,result_of用於獲取調用具有特定類型參數的函數對象的結果類型。例如: template <typename F, typename Arg> typename std::result_of<F(Arg)>::type invoke(F f, Arg a) { return f(a); }

    4熱度

    1回答

    考慮一個模板類,如: template<typename ReturnType, ReturnType Fn()> class Proxy { void run() { ReturnType ret = Fn(); // ... do something ... } }; // and a functions int fn1() {