Hacker News new | past | comments | ask | show | jobs | submit login

> Except usually not, as the memory copy only exists in principle and the optimiser will usually remove it. But that isn't visible at the language level.

that's the biggest difference form C++: a copy or move can, in principle, have observable side effects, so, aside from specifically santioned copy/move elision scenarios, the compiler cannot elide a copy or move constructor unless it can prove there are no visible side effects (usually by inlining the copy/move constructor and optimizing it away).

On the other hand this allows more flexible copy/move behaviour beyond just handling memory.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: