logoalt Hacker News

cocotoyesterday at 8:40 AM1 replyview on HN

Personally I see std::move more like removing ownership because it’s not explicit from its call where the ownership is transferred.


Replies

tsimionescuyesterday at 10:03 AM

Even that is a bit suspect, because ownership may well remain with you even after the call, so it's not really removed.

For example, this is perfectly valid C++, and it is guaranteed to have no issue:

  std::string abc = "abc";
  std::move(abc); //doesn't remove ownership or do anything really
  std::print(abc); //guaranteed to print "abc"