logoalt Hacker News

secondcomingyesterday at 1:17 PM2 repliesview on HN

What’s the problem? It makes perfect sense to me that a const object cannot be moved from, since it violates the constness. Since constness goes hand in hand with thread safety you really don’t want that violation.


Replies

spot5010yesterday at 1:26 PM

Maybe a compiler error that a const object cannot be “moved”?

That would force the programmer to remove the std::move, making it clear that its a copy.

show 3 replies
j1eloyesterday at 1:53 PM

To be honest I agree that it makes sense, at least if we put our hats of puritanism on the conceptual and semantical way of seeing it.

But having std::move silently fall back to a copy constructor is not a good solution.