阅读背景:

为什么在其他函数中声明的函数不参与参数相关查找?

来源:互联网 

Consider a simple example:

考虑一个简单的例子:

template <class T>
struct tag { };

int main() {
    auto foo = [](auto x) -> decltype(bar(x)) { return {}; };
    tag<int> bar(tag<int>);
    bar(tag<int>{}); // <- compiles OK
    foo(tag<int>{}); // 'bar' was not declared in this scope ?!
}

tag<int> bar(tag<int>) { return {}; }
templ



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

分享到: