|
It's not, because in both cases the expression may bind to an rvalue reference. In the first, std::make_unique already returns a pure rvalue. In the second, std::move does a cast to an rvalue reference, it's redundant. It also doesn't matter if the destination object is empty or not. The mere act of invoking assignment doesn't depend on how the reference it received was bound. The result would be the same, the previous (possibly non-existent) resource in the target will be replaced by the one "stolen" from the source. (责任编辑:) |
