Changeset - r23540:8ae17b2213ea
[Not reviewed]
master
0 2 0
Henry Wilson - 6 years ago 2019-03-13 20:55:31
m3henry@googlemail.com
Codechange: Use range-based for-loop in Auto[Free|Delete]SmallVector
2 files changed with 5 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/core/smallvec_type.hpp
Show inline comments
 
@@ -88,14 +88,14 @@ public:
 

	
 
	/**
 
	 * Remove all items from the list.
 
	 */
 
	inline void Clear()
 
	{
 
		for (uint i = 0; i < std::vector<T>::size(); i++) {
 
			free(std::vector<T>::operator[](i));
 
		for (T p : *this) {
 
			free(p);
 
		}
 

	
 
		std::vector<T>::clear();
 
	}
 
};
 

	
 
@@ -118,14 +118,14 @@ public:
 

	
 
	/**
 
	 * Remove all items from the list.
 
	 */
 
	inline void Clear()
 
	{
 
		for (uint i = 0; i < std::vector<T>::size(); i++) {
 
			delete std::vector<T>::operator[](i);
 
		for (T p : *this) {
 
			delete p;
 
		}
 

	
 
		std::vector<T>::clear();
 
	}
 
};
 

	
src/script/squirrel_helper.hpp
Show inline comments
 
@@ -29,13 +29,13 @@ namespace SQConvert {
 
	 *  comes out of scope. Useful to make sure you can use stredup(),
 
	 *  without leaking memory.
 
	 */
 
	struct SQAutoFreePointers : std::vector<void *> {
 
		~SQAutoFreePointers()
 
		{
 
			for (uint i = 0; i < std::vector<void *>::size(); i++) free(std::vector<void *>::operator[](i));
 
			for (void * p : *this) free(p);
 
		}
 
	};
 

	
 
	template <bool Y> struct YesT {
 
		static const bool Yes = Y;
 
		static const bool No = !Y;
0 comments (0 inline, 0 general)