gpt4 book ai didi

c++ - 通常的非限定查找和依赖于参数的名称查找(ADL)

转载 作者:行者123 更新时间:2023-11-28 07:54:43 30 4
gpt4 key购买 nike

对于非限定名称查找,“通常非限定名称查找”和“参数相关名称查找”(ADL),我无法在标准中找到哪一个先发生?

再次尝试向过载候选集添加一些内容,但顺序似乎并不重要。但仍然很高兴知道哪一个先发生。

谢谢

最佳答案

谁先到并不重要,不是吗?名称查找生成一组可能的名称。

3.4 Name lookup
Name lookup may associate more than one declaration with a name if it finds the name to be a function name; the declarations are said to form a set of overloaded functions.

标准专门说“设置”。作为数学构造,集合 {1,2,3} 与 {2,3,1} 和 {3,2,1} 相同。顺序无关紧要。重要的是何时发生重载决议和应用程序访问规则。这里的标准很明确。再次引用 3.4 的介绍段落:

Overload resolution takes place after name lookup has succeeded. The access rules are considered only once name lookup and function overload resolution have succeeded.

关于c++ - 通常的非限定查找和依赖于参数的名称查找(ADL),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12956600/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com