Unsafety with uniq_ptr in C++