Open
Description
#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();};
是为什么
Metadata
Metadata
Assignees
Labels
No labels