相关疑难解决方法(0)

decltype和成员函数(非指针)类型

struct C
{
    int Foo(int i) { return i; }

    typedef decltype(C::Foo) type;
};
Run Code Online (Sandbox Code Playgroud)

由于没有成员函数类型这样的类型(没有,有吗?),我希望C::type如此int (int).

但以下将无法使用Visual C++ 2012 RC进行编译:

std::function<C::type> f;
Run Code Online (Sandbox Code Playgroud)

那是什么类型的decltype(C::Foo)

c++ decltype visual-c++ c++11 visual-c++-2012

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

标签 统计

c++ ×1

c++11 ×1

decltype ×1

visual-c++ ×1

visual-c++-2012 ×1