On Tue, 21 Jun 2011 18:18:26 +0300, Michel Fortin <[email protected]> wrote:

Actually, no copy is needed. Move takes the argument by ref so it can obliterates it. Obliteration consists of replacing its bytes with those in S.init. That way if you have a smart pointer, it gets returned without having to update the reference count (since the source's content has been destroyed). It was effectively be moved, not copied.

T move(ref T a) {
  T b;
  move(a, b);
  return b;
}

T a;
whatever = move(a);

If T is a struct, i don't see how a copy is not needed looking at the current state of move.

Reply via email to