Files
test2/source
Iliya Katueshenock 65abb1ef93 BLI: improve Map iteration API to avoid common issues at compile time
Doing something like `for (auto key : get_map().keys())` does not work, because the lifetime
of the `Map` returned by `get_map()` is not automatically extended for the duration of
the loop. This could cause crashes at run-time.

Now this pattern will not compile anymore. Note that there are possible valid use-cases
of this iterating over a `Map` that won't compile anymore either. This is fairly uncommon
though, and just storing the map in a separate temporary variable is a simple fix.
This would have been a valid usage for example: `do_something(get_map().keys())`.

This would have prevented e.g. 9840dd233c.

Pull Request: https://projects.blender.org/blender/blender/pulls/129880
2024-11-14 10:54:50 +01:00
..