下面突出显示的句子是什么意思?跟函数模板有关系吗?
Not all function declarations can be overloaded. Those that cannot be overloaded are specified here. A program is ill-formed if it contains two such non-overloadable declarations in the same scope. [ Note: This restriction applies to explicit declarations in a scope, and between such declarations and declarations made through a using-declaration ([namespace.udecl]). It does not apply to sets of functions fabricated as a result of name lookup (e.g., because of using-directives) or overload resolution (e.g., for operator functions). — end note ]
最佳答案
你可以这样做:
namespace N {
void f(int);
}
namespace M {
int f(int);
}
using namespace N; // ok
using namespace M; // ok
// even if both have conflicting f's
您并没有直接在此处重载任何内容。 using 指令允许名称查找来查找这两个函数,而此时调用是不明确的。
这里的函数集包含两个不可重载的函数,但由于它们是根据引用通过名称查找找到的,所以它们没问题。
关于c++ - [over.load]/1 下面突出显示的句子是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57042197/