阅读背景:

为什么自动返回类型演绎在没有完全定义类型的情况下工作?

来源:互联网 

Consider the following:

考虑以下:

template<typename Der>
struct Base {
    // NOTE: if I replace the decltype(...) below with auto, code compiles
    decltype(&Der::operator()) getCallOperator() const {
        return &Der::operator();
    }
};

struct Foo : Base<Foo> {
    double operator()(int, int) const {
        return 0.0;
    }
};

int main() {
    Foo f;
    auto callOp = f.getCallOperator();
}
template<type



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: