小编Die*_*uza的帖子

int()和int(*)()之间有什么区别?

我正在尝试创建一个标识函数的类模板,我可以在其中识别函数何时专门用于类模型R (*) (),但是std::function你可以声明 return_type (),并且std::is_same< int(), int (*) () >.::value为零.

这是什么int ()说法意味着与之间有什么区别int ()和?
int (*) ()

更新: int ()函数声明或函数类型int (*)()也是函数类型的指针.但是它是类型函数吗?它是类似的东西,或者像是什么?我怎样才能使这个程序输出1? int (std::string::)() int std::string::()std::function int(const std::string&)

#include <iostream>
template<typename A,typename B>
struct IsSame{
  enum{
      value = 0};
};
template<typename A>
struct IsSame<A,A>{
    enum{
        value = 1  
    };
};
typedef int (SumType)(int,int)const;
class X{
  public:
        SumType sum;    
};
int X::sum(int …
Run Code Online (Sandbox Code Playgroud)

c++ templates

5
推荐指数
1
解决办法
206
查看次数

标签 统计

c++ ×1

templates ×1