Quantcast
Channel: User HolyBlackCat - Stack Overflow
Viewing all articles
Browse latest Browse all 1287

Comment by HolyBlackCat on Is it a good idea to use `std::move` with a function that receives const ref?

$
0
0
@PepijnKramer std::move doesn't always express ownership transfer. In a template, it can very well express "I'm not going to use this object anymore, you can do whatever you want with it" (i.e. "transfer ownership if applicable"). E.g. if you have a template with std::move in it, then instantiate it for an int, you surely wouldn't worry about a useless move. If we're fine with this meaning of move in templates, I think it's not necessarily bad outside of templates too.

Viewing all articles
Browse latest Browse all 1287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>