I found the code below in the section "C ++ Programming Language, Fourth Edition", chapter 17.5.1.3
struct S2 { shared_ptr<int> p; }; S2 x {new int{0}}; void f() { S2 y {x};
I don't understand the last comment, indeed, yp should point to the new memory address after calling reset (), and therefore
โxp = 4;
should leave yp unchanged, right?
thanks
c ++ pointers
fjammes
source share