Files
test2/source/blender/blenlib
Guillermo Venegas e23b8eeb42 BLI: destruct non-trivial types after using remove_if
`Vector::remove_if` allows certain elements to be removed based on a predicate.
However `std::remove_if` only shifts the elements that will not be deleted
to the beginning of the container and then `Vector::remove_if` only
updates the pointer to the new last element after using `std::remove_if`.
This works well if `Vector` is used with trivial types that don't have a destructor.

Having a `Vector<std::unique_ptr>` for example, can generate undefined behavior
if the predicate gives `true` to elements that are contiguous at the end, if
`Vector::remove_if` only updates the end pointer in these specific cases, these
makes these smart pointers useless because  they will not be freed by themselves.

To prevent that, also destruct the elements being removed.

Pull Request: https://projects.blender.org/blender/blender/pulls/115914
2023-12-12 10:42:04 +01:00
..
2023-08-25 11:46:37 +02:00
2023-07-27 14:16:58 +02:00
2023-12-03 15:41:04 +05:30
2023-11-13 08:12:39 +01:00
2023-12-05 23:01:12 +01:00