Skip to content

Conversation

@PeterN
Copy link
Member

@PeterN PeterN commented Dec 8, 2025

AllocArray is a wrapper around std::vector<T *> with new/delete used to manage the lifetime of objects within the vector.

Instead, use std::vector<std::unique_ptr<T>>, to avoid manual memory management.

Removes manual memory management and obfuscation.
Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dare I ask if you can simplify further to sts::vector<T> in some/all cases?

@PeterN
Copy link
Member Author

PeterN commented Dec 8, 2025

Dare I ask if you can simplify further to sts::vector<T> in some/all cases?

There is only one usage of this, and it uses polymorphism, so... I don't think so.

@PeterN PeterN merged commit f5837f8 into OpenTTD:master Dec 9, 2025
6 checks passed
@PeterN PeterN deleted the remove-allocarray branch December 9, 2025 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants