Skip to main content
6 events
when toggle format what by license comment
Jul 28, 2022 at 17:24 vote accept CommunityBot
Jul 28, 2022 at 17:19 comment added infinitezero You understood it wrong. You can alter the elements, but you can not / should not erase or add elements while iterating. See this example here
Jul 28, 2022 at 17:13 comment added user263351 I think altering elements while iterating is not possible according to this link: stackoverflow.com/questions/6438086/…
Jul 28, 2022 at 17:09 comment added infinitezero If you do not use it, each loop iteration will create a copy. You can also drop the const and just use a ref, if you want to alter elements while iterating.
Jul 28, 2022 at 17:05 comment added user263351 In the for loop, why did you use the const& keyword after auto ?
Jul 28, 2022 at 16:50 history answered infinitezero CC BY-SA 4.0