struct P{
int* x;
P(int& px):x(&px){}
};
struct R{
int& x;
R(int& px):x(px){}
};
int main(){
int i;
P p1(i),p2(i);
R r1(i),r2(i);
p1=p2; //OK
r1=r2; //error: non-static reference member ‘int& R::x’, can’t use default assignment operator
note: synthesized method ‘R& R::operator=(const R&)’ first required here
}
No comments:
Post a Comment