(svn r17527) -Codechange: use QSortT instead of qsort for sorting smallmaps
This commit is contained in:
		@@ -13,6 +13,7 @@
 | 
				
			|||||||
#define SMALLMAP_TYPE_HPP
 | 
					#define SMALLMAP_TYPE_HPP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "smallvec_type.hpp"
 | 
					#include "smallvec_type.hpp"
 | 
				
			||||||
 | 
					#include "sort_func.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Simple pair of data. Both types have to be POD ("Plain Old Data")! */
 | 
					/** Simple pair of data. Both types have to be POD ("Plain Old Data")! */
 | 
				
			||||||
template <typename T, typename U>
 | 
					template <typename T, typename U>
 | 
				
			||||||
@@ -105,14 +106,12 @@ struct SmallMap : SmallVector<SmallPair<T, U>, S> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	FORCEINLINE void SortByKey()
 | 
						FORCEINLINE void SortByKey()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		qsort(this->Begin(), this->items, sizeof(Pair), KeySorter);
 | 
							QSortT(this->Begin(), this->items, KeySorter);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static int CDECL KeySorter(const void *a, const void *b)
 | 
						static int CDECL KeySorter(const Pair *a, const Pair *b)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		const Pair *pa = (const Pair*)a;
 | 
							return a->first - b->first;
 | 
				
			||||||
		const Pair *pb = (const Pair*)b;
 | 
					 | 
				
			||||||
		return pa->first - pb->first;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user