Re:C++ Is an Absolute Blast
by Maxatar on Tuesday December 24, 2024 @02:17AM
(#42500231)
It's the optimization that C++ is unable to perform, not the immutability.
[ Parent
| on HN ]
If you declare using an invalidated iterator as UB, the compiler can optimize as if the container was effectively immutable during the loop.
Re:C++ Is an Absolute Blast
by CyberDildonics on Tuesday December 24, 2024 @10:22AM
(#42502447)
Are you talking about optimizing out bounds checking that isn't happening in the first place?