mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
Codechange: Use range-based for-loop in Auto[Free|Delete]SmallVector
This commit is contained in:
parent
cc62f4163f
commit
03ca3190c9
@ -91,8 +91,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
inline void Clear()
|
inline void Clear()
|
||||||
{
|
{
|
||||||
for (uint i = 0; i < std::vector<T>::size(); i++) {
|
for (T p : *this) {
|
||||||
free(std::vector<T>::operator[](i));
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<T>::clear();
|
std::vector<T>::clear();
|
||||||
@ -121,8 +121,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
inline void Clear()
|
inline void Clear()
|
||||||
{
|
{
|
||||||
for (uint i = 0; i < std::vector<T>::size(); i++) {
|
for (T p : *this) {
|
||||||
delete std::vector<T>::operator[](i);
|
delete p;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<T>::clear();
|
std::vector<T>::clear();
|
||||||
|
@ -32,7 +32,7 @@ namespace SQConvert {
|
|||||||
struct SQAutoFreePointers : std::vector<void *> {
|
struct SQAutoFreePointers : std::vector<void *> {
|
||||||
~SQAutoFreePointers()
|
~SQAutoFreePointers()
|
||||||
{
|
{
|
||||||
for (uint i = 0; i < std::vector<void *>::size(); i++) free(std::vector<void *>::operator[](i));
|
for (void * p : *this) free(p);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user