为什么 C++20 允许编译默认比较,即使它被删除?
作者:NoSenseEtAl 提问时间:2/5/2021
请考虑以下代码: struct A { }; struct B { A a; bool operator == (const B& other) const = default; }; Cl...
defaulted-functions 问答列表
作者:NoSenseEtAl 提问时间:2/5/2021
请考虑以下代码: struct A { }; struct B { A a; bool operator == (const B& other) const = default; }; Cl...
作者:Jan Schultke 提问时间:9/13/2023
C++20 使默认比较运算符成为可能,包括像这样的三向比较。 可以具有推导的返回类型,但其他运算符不能:<=> struct S { friend auto operator<=>(const S...