This is the version 6164200e16f527661ebdaa71 from 2021-10-11 11:29:18 comment: 'name rule'
c++ r-value references ed
- r-value ref parameters are l-values! (they have a name)
void g(const X &x);
void g(X && x);
void f(X && x) {
g(x); // will call g(const X &x)
}
- fix: std::move()
void f(X && x) {
g(std::move(x)); // will call g(X && x)
}
Categories: c++, Programmieren