mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
gcc problems
This commit is contained in:
parent
16128382a9
commit
0466905408
@ -83,8 +83,6 @@ operator () (const Key &a, const Key &b) const {
|
|||||||
return (a != b && (*a).get_name() < (*b).get_name());
|
return (a != b && (*a).get_name() < (*b).get_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_STL_HASH
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: integer_hash::add_hash
|
// Function: integer_hash::add_hash
|
||||||
// Access: Public, Static
|
// Access: Public, Static
|
||||||
@ -162,7 +160,7 @@ operator () (const Key &key) const {
|
|||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
INLINE size_t sequence_hash<Key, Compare>::
|
INLINE size_t sequence_hash<Key, Compare>::
|
||||||
add_hash(size_t hash, const Key &key) {
|
add_hash(size_t hash, const Key &key) {
|
||||||
Key::const_iterator ki;
|
TYPENAME Key::const_iterator ki;
|
||||||
for (ki = key.begin(); ki != key.end(); ++ki) {
|
for (ki = key.begin(); ki != key.end(); ++ki) {
|
||||||
hash = (hash * 31) + (size_t)(*ki);
|
hash = (hash * 31) + (size_t)(*ki);
|
||||||
}
|
}
|
||||||
@ -190,5 +188,3 @@ INLINE size_t indirect_method_hash<Key, Compare>::
|
|||||||
operator () (const Key &key) const {
|
operator () (const Key &key) const {
|
||||||
return (*key).get_hash();
|
return (*key).get_hash();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAVE_STL_HASH
|
|
||||||
|
@ -24,8 +24,22 @@
|
|||||||
#include "nearly_zero.h"
|
#include "nearly_zero.h"
|
||||||
|
|
||||||
#ifdef HAVE_STL_HASH
|
#ifdef HAVE_STL_HASH
|
||||||
#include <hash_map>
|
#include <hash_map> // for hash_compare
|
||||||
#include <hash_set>
|
|
||||||
|
#define stl_hash_compare hash_compare
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <map> // for less
|
||||||
|
|
||||||
|
// This is declared for the cases in which we don't have STL_HASH
|
||||||
|
// available--it's just a name to inherit from, but there's no need to
|
||||||
|
// provide much functionality in the base class (since it won't
|
||||||
|
// actually be used for hashing, just for comparing).
|
||||||
|
template<class Key, class Compare = less<Key> >
|
||||||
|
class stl_hash_compare : public Compare {
|
||||||
|
};
|
||||||
|
|
||||||
#endif // HAVE_STL_HASH
|
#endif // HAVE_STL_HASH
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -95,8 +109,6 @@ public:
|
|||||||
INLINE bool operator () (const Key &a, const Key &b) const;
|
INLINE bool operator () (const Key &a, const Key &b) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAVE_STL_HASH
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Class : integer_hash
|
// Class : integer_hash
|
||||||
// Description : This is the default hash_compare class, which assumes
|
// Description : This is the default hash_compare class, which assumes
|
||||||
@ -106,7 +118,7 @@ public:
|
|||||||
// system-provided hash_compare.
|
// system-provided hash_compare.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare = less<Key> >
|
template<class Key, class Compare = less<Key> >
|
||||||
class integer_hash : public hash_compare<Key, Compare> {
|
class integer_hash : public stl_hash_compare<Key, Compare> {
|
||||||
public:
|
public:
|
||||||
INLINE static size_t add_hash(size_t start, const Key &key);
|
INLINE static size_t add_hash(size_t start, const Key &key);
|
||||||
};
|
};
|
||||||
@ -116,7 +128,7 @@ public:
|
|||||||
// Description : This hash_compare class hashes a float or a double.
|
// Description : This hash_compare class hashes a float or a double.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key>
|
template<class Key>
|
||||||
class floating_point_hash : public hash_compare<Key> {
|
class floating_point_hash : public stl_hash_compare<Key> {
|
||||||
public:
|
public:
|
||||||
INLINE floating_point_hash(Key threshold = get_nearly_zero_value((Key)0));
|
INLINE floating_point_hash(Key threshold = get_nearly_zero_value((Key)0));
|
||||||
INLINE size_t operator () (const Key &key) const;
|
INLINE size_t operator () (const Key &key) const;
|
||||||
@ -132,11 +144,11 @@ public:
|
|||||||
// methods that iterate through Key::value_type.
|
// methods that iterate through Key::value_type.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare = less<Key> >
|
template<class Key, class Compare = less<Key> >
|
||||||
class sequence_hash : public hash_compare<Key, Compare> {
|
class sequence_hash : public stl_hash_compare<Key, Compare> {
|
||||||
public:
|
public:
|
||||||
INLINE size_t operator () (const Key &key) const;
|
INLINE size_t operator () (const Key &key) const;
|
||||||
INLINE bool operator () (const Key &a, const Key &b) const {
|
INLINE bool operator () (const Key &a, const Key &b) const {
|
||||||
return hash_compare<Key, Compare>::operator () (a, b);
|
return stl_hash_compare<Key, Compare>::operator () (a, b);
|
||||||
}
|
}
|
||||||
INLINE static size_t add_hash(size_t start, const Key &key);
|
INLINE static size_t add_hash(size_t start, const Key &key);
|
||||||
};
|
};
|
||||||
@ -148,11 +160,11 @@ public:
|
|||||||
// that returns a size_t.
|
// that returns a size_t.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare = less<Key> >
|
template<class Key, class Compare = less<Key> >
|
||||||
class method_hash : public hash_compare<Key, Compare> {
|
class method_hash : public stl_hash_compare<Key, Compare> {
|
||||||
public:
|
public:
|
||||||
INLINE size_t operator () (const Key &key) const;
|
INLINE size_t operator () (const Key &key) const;
|
||||||
INLINE bool operator () (const Key &a, const Key &b) const {
|
INLINE bool operator () (const Key &a, const Key &b) const {
|
||||||
return hash_compare<Key, Compare>::operator () (a, b);
|
return stl_hash_compare<Key, Compare>::operator () (a, b);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -164,36 +176,14 @@ public:
|
|||||||
// a size_t.
|
// a size_t.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class Key, class Compare>
|
template<class Key, class Compare>
|
||||||
class indirect_method_hash : public hash_compare<Key, Compare> {
|
class indirect_method_hash : public stl_hash_compare<Key, Compare> {
|
||||||
public:
|
public:
|
||||||
INLINE size_t operator () (const Key &key) const;
|
INLINE size_t operator () (const Key &key) const;
|
||||||
INLINE bool operator () (const Key &a, const Key &b) const {
|
INLINE bool operator () (const Key &a, const Key &b) const {
|
||||||
return hash_compare<Key, Compare>::operator () (a, b);
|
return stl_hash_compare<Key, Compare>::operator () (a, b);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#else // HAVE_STL_HASH
|
|
||||||
|
|
||||||
// If the STL doesn't provide any hash methods, then all of the above
|
|
||||||
// simply map to their Compare function.
|
|
||||||
template<class Key, class Compare = less<Key> >
|
|
||||||
class floating_point_hash : public Compare {
|
|
||||||
};
|
|
||||||
template<class Key, class Compare = less<Key> >
|
|
||||||
class integer_hash : public Compare {
|
|
||||||
};
|
|
||||||
template<class Key, class Compare = less<Key> >
|
|
||||||
class sequence_hash : public Compare {
|
|
||||||
};
|
|
||||||
template<class Key, class Compare = less<Key> >
|
|
||||||
class method_hash : public Compare {
|
|
||||||
};
|
|
||||||
template<class Key, class Compare>
|
|
||||||
class indirect_method_hash : public Compare {
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // HAVE_STL_HASH
|
|
||||||
|
|
||||||
#include "stl_compares.I"
|
#include "stl_compares.I"
|
||||||
|
|
||||||
typedef floating_point_hash<float> float_hash;
|
typedef floating_point_hash<float> float_hash;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user