当前草案是否允许形成一个重载集,该重载集由两个非静态成员声明组成,其中一个具有 ref-qualifier
Does that the current draft permit to form an overload set that consists of two non-static member declarations where one has ref-qualifier
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)
上述规则可以理解为,对于两个具有相同parameter-type-list的非静态成员函数,如果任何一个有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, but since that orthogonality allows a few additional meaningful overload sets, there hasn’t been any hurry to “fix” it. In particular, it might work well with the proposal for deducing this
的无意结果,目前正在考虑中。
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)
上述规则可以理解为,对于两个具有相同parameter-type-list的非静态成员函数,如果任何一个有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, but since that orthogonality allows a few additional meaningful overload sets, there hasn’t been any hurry to “fix” it. In particular, it might work well with the proposal for deducing this
的无意结果,目前正在考虑中。