We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#include <concepts> #include <iostream> #include <type_traits> class Data { public: Data(int x, int y) : x{x}, y{y} {} int x; int y; void show() { std::cerr << x << " " << y << "\n"; } };
不行:
const bool a = requires (Data d{1, 2}) {d.show();};
行:
const bool a = requires (Data d = Data{1, 2}) {d.show();};
是为什么
The text was updated successfully, but these errors were encountered:
此处语法与函数的默认实参一致,必须有 =。
=
Sorry, something went wrong.
不对。这是错误的, requires 表达式的参数列表不能有默认实参。
目前 GCC 接受这种错误的写法(链接),此为已经确认的 bug。
No branches or pull requests
不行:
行:
是为什么
The text was updated successfully, but these errors were encountered: