Using C++11 move semantics to enhance code safety