From 03ca3190c9b73de3e43fe1e7e2293b8c1e3aa3d5 Mon Sep 17 00:00:00 2001 From: Henry Wilson Date: Wed, 13 Mar 2019 20:55:31 +0000 Subject: Codechange: Use range-based for-loop in Auto[Free|Delete]SmallVector --- src/core/smallvec_type.hpp | 8 ++++---- src/script/squirrel_helper.hpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/smallvec_type.hpp b/src/core/smallvec_type.hpp index e71edf89f..f43265ebe 100644 --- a/src/core/smallvec_type.hpp +++ b/src/core/smallvec_type.hpp @@ -91,8 +91,8 @@ public: */ inline void Clear() { - for (uint i = 0; i < std::vector::size(); i++) { - free(std::vector::operator[](i)); + for (T p : *this) { + free(p); } std::vector::clear(); @@ -121,8 +121,8 @@ public: */ inline void Clear() { - for (uint i = 0; i < std::vector::size(); i++) { - delete std::vector::operator[](i); + for (T p : *this) { + delete p; } std::vector::clear(); diff --git a/src/script/squirrel_helper.hpp b/src/script/squirrel_helper.hpp index add6b49c1..10f04f945 100644 --- a/src/script/squirrel_helper.hpp +++ b/src/script/squirrel_helper.hpp @@ -32,7 +32,7 @@ namespace SQConvert { struct SQAutoFreePointers : std::vector { ~SQAutoFreePointers() { - for (uint i = 0; i < std::vector::size(); i++) free(std::vector::operator[](i)); + for (void * p : *this) free(p); } }; -- cgit v1.2.3-70-g09d2