Move in C++ without a std:move

(andreasfertig.com)

13 points | by dalvrosa 23 hours ago

4 comments

  • sprocketz 4 minutes ago
    What is that makes NVRO so much more difficult to implement? Why couldn't they mandate that just like RVO? Do compilers literally just special case a simple return statement of a direct construction or something?
  • fluoridation 18 minutes ago
    Unfortunately, I don't think there's getting away from just understanding value semantics to get the correct and/or performant behavior.
  • tom_ 21 minutes ago
    If the author is reading: both complicated examples are the same.
    • quuxplusone 8 minutes ago
      Yeah, the second one is supposed to read `Apple&& Cat(Apple&& val) { return val; }` — but the return type's `&&` was omitted by accident.
  • hn45e7pbij 23 hours ago
    I'd push back slightly on move — at small scale the opposite has been true for me.
    • dalvrosa 23 hours ago
      Not sure what you mean, but std::move is one of the greatest tools in C++
      • pdpi 1 minute ago
        This is one case where Rust benefited from C++’s experience — move by default with opt-in clone/copy is IMO the better setup.