I am playing around with boost scoped pointers and I don't understand this behaviour:
#include <iostream>
#include <boost/scoped_ptr.hpp>
int main()
{
boost::scoped_ptr<int> p{new int{1}};
std::cout << &p << '\n';
p.reset(new int {2});
std::cout << &p << '\n';
return 0;
}
I get the following output:
0x7fff5fbff650
0x7fff5fbff650
Shouldn't the reset function change the address pointed by p? this is the case if use a scoped array instead of a scoped pointer and print the address pointed by the first element in the code above.