Im confused about Y y {X{}}; what exactly this line does and where is connection to Most vexing parse , a brief explanation is appreciated
#include <iostream>
struct X {
X() { std::cout << "X"; }
};
struct Y {
Y(const X &x) { std::cout << "Y"; }
void f() { std::cout << "f"; }
};
int main() {
Y y {X{}};
y.f();
}
Aucun commentaire:
Enregistrer un commentaire