News for hackers. Stuff that matters.
Re:Catching use-after-move C++ bugs with Clang's consumed an... by namirez on Thursday July 11, 2019 @12:09AM (#20409043)
Shallow copy is the general concept. Move semantics is a special case where the unique ownership is enforced. Here is simple example of the idea:

  Widget::Widget(Widget&& w) {
    this->ptr = w.ptr; // shallow copy
    w.ptr = nullptr; // nullify the source
  }
Re:Catching use-after-move C++ bugs with Clang's consumed an... by clappski on Thursday July 11, 2019 @04:20AM (#20409969)
You could use;

auto* p2 = std::exchange( p1, nullptr );