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

It's the optimization that C++ is unable to perform, not the immutability.



Are you talking about optimizing out bounds checking that isn't happening in the first place?


If you declare using an invalidated iterator as UB, the compiler can optimize as if the container was effectively immutable during the loop.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: