Pass in a const reference to a CompareFunc for quickSort, to make Visual Studio 2011 happy.

Thanks to Cameron Hart
Fixes Issue 588
This commit is contained in:
erwin.coumans
2012-01-23 21:39:44 +00:00
parent ce50f11fea
commit f754952232
11 changed files with 14 additions and 13 deletions

View File

@@ -22,6 +22,7 @@
#include <set>
#include <vector>
#include <queue>
#include <functional>
namespace HACD
{

View File

@@ -246,7 +246,7 @@ class btBroadphasePairSortPredicate
{
public:
bool operator() ( const btBroadphasePair& a, const btBroadphasePair& b )
bool operator() ( const btBroadphasePair& a, const btBroadphasePair& b ) const
{
const int uidA0 = a.m_pProxy0 ? a.m_pProxy0->m_uniqueId : -1;
const int uidB0 = b.m_pProxy0 ? b.m_pProxy0->m_uniqueId : -1;

View File

@@ -341,7 +341,7 @@ class btMultiSapBroadphasePairSortPredicate
{
public:
bool operator() ( const btBroadphasePair& a1, const btBroadphasePair& b1 )
bool operator() ( const btBroadphasePair& a1, const btBroadphasePair& b1 ) const
{
btMultiSapBroadphase::btMultiSapProxy* aProxy0 = a1.m_pProxy0 ? (btMultiSapBroadphase::btMultiSapProxy*)a1.m_pProxy0->m_multiSapParentProxy : 0;
btMultiSapBroadphase::btMultiSapProxy* aProxy1 = a1.m_pProxy1 ? (btMultiSapBroadphase::btMultiSapProxy*)a1.m_pProxy1->m_multiSapParentProxy : 0;

View File

@@ -193,7 +193,7 @@ class btPersistentManifoldSortPredicate
{
public:
SIMD_FORCE_INLINE bool operator() ( const btPersistentManifold* lhs, const btPersistentManifold* rhs )
SIMD_FORCE_INLINE bool operator() ( const btPersistentManifold* lhs, const btPersistentManifold* rhs ) const
{
return getIslandId(lhs) < getIslandId(rhs);
}

View File

@@ -53,7 +53,7 @@ class btUnionFindElementSortPredicate
{
public:
bool operator() ( const btElement& lhs, const btElement& rhs )
bool operator() ( const btElement& lhs, const btElement& rhs ) const
{
return lhs.m_id < rhs.m_id;
}

View File

@@ -58,7 +58,7 @@ class CONTACT_KEY_TOKEN_COMP
{
public:
bool operator() ( const CONTACT_KEY_TOKEN& a, const CONTACT_KEY_TOKEN& b )
bool operator() ( const CONTACT_KEY_TOKEN& a, const CONTACT_KEY_TOKEN& b ) const
{
return ( a < b );
}

View File

@@ -71,7 +71,7 @@ class btSortConstraintOnIslandPredicate
{
public:
bool operator() ( const btTypedConstraint* lhs, const btTypedConstraint* rhs )
bool operator() ( const btTypedConstraint* lhs, const btTypedConstraint* rhs ) const
{
int rIslandId0,lIslandId0;
rIslandId0 = btGetConstraintIslandId(rhs);

View File

@@ -1245,7 +1245,7 @@ void btDX11SoftBodySolver::prepareCollisionConstraints()
{
public:
bool operator() ( const CollisionShapeDescription& a, const CollisionShapeDescription& b )
bool operator() ( const CollisionShapeDescription& a, const CollisionShapeDescription& b ) const
{
return ( a.softBodyIdentifier < b.softBodyIdentifier );
}

View File

@@ -1175,7 +1175,7 @@ class QuickSortCompare
{
public:
bool operator() ( const CollisionShapeDescription& a, const CollisionShapeDescription& b )
bool operator() ( const CollisionShapeDescription& a, const CollisionShapeDescription& b ) const
{
return ( a.softBodyIdentifier < b.softBodyIdentifier );
}

View File

@@ -314,7 +314,7 @@ protected:
};
template <typename L>
void quickSortInternal(L CompareFunc,int lo, int hi)
void quickSortInternal(const L& CompareFunc,int lo, int hi)
{
// lo is the lower index, hi is the upper index
// of the region of array a that is to be sorted
@@ -344,7 +344,7 @@ protected:
template <typename L>
void quickSort(L CompareFunc)
void quickSort(const L& CompareFunc)
{
//don't sort 0 or 1 elements
if (size()>1)
@@ -356,7 +356,7 @@ protected:
///heap sort from http://www.csse.monash.edu.au/~lloyd/tildeAlgDS/Sort/Heap/
template <typename L>
void downHeap(T *pArr, int k, int n,L CompareFunc)
void downHeap(T *pArr, int k, int n, const L& CompareFunc)
{
/* PRE: a[k+1..N] is a heap */
/* POST: a[k..N] is a heap */
@@ -402,7 +402,7 @@ protected:
}
template <typename L>
void heapSort(L CompareFunc)
void heapSort(const L& CompareFunc)
{
/* sort a[0..N-1], N.B. 0 to N-1 */
int k;

View File

@@ -39,7 +39,7 @@ struct btAngleCompareFunc {
: m_anchor(anchor)
{
}
bool operator()(const GrahamVector2& a, const GrahamVector2& b) {
bool operator()(const GrahamVector2& a, const GrahamVector2& b) const {
if (a.m_angle != b.m_angle)
return a.m_angle < b.m_angle;
else