-
4 votesanswersviews
c扣除“非类型指针函数”类模板参数
考虑一个模板类,如: template<typename ReturnType, ReturnType Fn()> class Proxy { void run() { ReturnType ret = Fn(); // ... do something ... } }; // and a functions int fn1()... -
0 votesanswersviews
有人可以解释如何在模板中使用result_of吗?
我正在尝试创建一个可延迟的调用对象 . 某些东西(伪代码): template <class FN> struct delayable_call { return-type-of-FN call(); // <-- I'd like to use result_of here. template<class ArgTypes...> dela... -
20 votesanswersviews
带有cv限定参数的成员对象的result_of
鉴于以下声明: struct MyClass { }; typedef int MyClass::*Mp; 在我尝试过的gcc 6.2和Clang编译器上, result_of<Mp(const MyClass)>::type 产生 int&& . Summary of my question: 为什么 int&& 而不是 const int&... -
1 votesanswersviews
调用模板参数的成员函数的result_of
我需要获取类的模板参数的成员函数的结果 . 不幸的是,我被绑定到C 03并且不能使用decltype,但我可以使用tr1 :: result_of . 我尝试了下面的代码,但是这对我的编译器不起作用(gcc 4.3,我也无法改变这个): #include <tr1/functional> struct ReturnType {}; struct O { ReturnT...