Should one use a std::move on a nullptr assignment?
c++11, move-semantics, nullptr
Solution
`nullptr` is by definition an rvalue (C++11 §2.14.7p1), so `std::move(nullptr)` is `nullptr`. It has no effect, just as would be the case for passing any other rvalue literal to `std::move`, e.g., `std::move(3)` or `std::move(true)`.
Problem
I came across the following. Is there any advantage to doing a move on the nullptr? I assume it is basically assigning a zero to Node* so I am not sure if there is any advantage to do a move here. Any thoughts? ``` template <typename T> struct Node { Node(const T& t): data(t), next(std::move(nullptr)) { } Node(T&& t): data(std::move(t)), next(std::move(nullptr)) { } T data; Node* next; }; ```