I understand how to move an object, for example:
int a(5), b(6);
int c(std::move(a)); // move constructor
c = std::move(b); // move assignment
I understand the common implementation of a custom move constructor (which takes the ownership of a dynamic pointer and sets the moved-from pointer to nullptr.)
But I haven't found anything about moving a dynamically allocated pointer itself. I need confirmation that the following code is legal:
int *p(new int(42));
int val(std::move(*p));
delete p; // I think this is no longer necessary. Is it?
So, is it allowed to move a dynamic pointer?