You should definitely upgrade to the first version, as the second basically does everything the first version does, with more code and less readability.
From a philosophical point of view, the second version moves a unique pointer, neither more nor less. so why go around the table instead of using an existing, more readable, and more idiomatic std::unique_ptr(std::unique_ptr&&) ?
And finally, if your smart pointer somewhere in the future contains a custom removal tool, the first version will make sure that the removal tool also moves, and the second version does not move the removal tool. I can definitely imagine a programmer creating a non-standard pointer to a unique remover from a non-standard remover unique_pointer using release . With relocation semantics, the program cannot compile.
source share