both declare functions with the same parameter-type-list, equivalent ([temp.over.link]) trailing requires-clauses (if any, except as specified in [temp.friend]), and, if both are non-static members, the same cv-qualifiers (if any) and ref-qualifier (if both have one)
上面的规则可以理解为,对于两个具有相同参数类型列表的非静态成员函数,如果有人有一个 cv-qualifiers,那么两个声明应该有相同的 cv-qualifiers;如果两个声明都有 ref-qualifier,则它们应该具有相同的 ref-qualifier。否则,它们不对应。
struct A{
void show(); //#1
void show() const &; //#2
};
在这个片段中,#1 是否对应于 #2?由于 #2 有一个 cv 限定符而 #1 没有,即使具有相同的条件 ref-qualifier
是真的,根据规则(注意该规则中强调的 和 ),它们不对应。那么,这是否意味着草案允许从这两个声明中形成一个重载集?毕竟是over.load#2.3已被 P1787 删除。
最佳答案
此更改是 phrasing the rules more orthogonally 的无意结果,但由于这种正交性允许一些额外的有意义的重载集,所以并不急于“修复”它。特别是,它可能适用于 proposal for deducing this
目前正在考虑中。
关于c++ - 当前草案是否允许形成由两个非静态成员声明组成的重载集,其中一个具有引用限定符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66635738/