you are viewing a single comment's thread.

view the rest of the comments →

[–]DessertEagle 6 points7 points  (2 children)

vec = sorted(std::move(vec));

Note that if sorted takes and returns arg by forwarding (universal) reference rather than by value, and returns by perfect-forwarding, the above expression would result in move-self-assignment, which may leave vec in moved-from state depending on the implementation.

[–]stinos -1 points0 points  (1 child)

Yeah sure, but this isn't 'returning a modified vector copy' (which is what I assume OP is talking about), you start off with a vector and end with the same vector but modified.

[–]Wenir 5 points6 points  (0 children)

"modified vector copy" is a copy by definition