阅读背景:

使用std :: function时,选择自动返回类型的调用操作符而不是构造函数

来源:互联网 

The following snippet:

以下片段:

#include <functional>

struct X {
    X(std::function<double(double)> fn); // (1)
    X(double, double);                   // (2)

    template <class T>
    auto operator()(T const& t) const {  // (3)
        return t.foo();
    }
};

int main() {
    double a, b;
    auto x = X(a, b);
    return 0;
}
#include <func



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

分享到: