removed old style usage of hash map and substituted with c+11 sytle unordered set and map.
This commit is contained in:
parent
ad95129d02
commit
47aaea332a
|
@ -24,34 +24,7 @@
|
||||||
#ifndef VCG_MATH_UNIONSET_H
|
#ifndef VCG_MATH_UNIONSET_H
|
||||||
#define VCG_MATH_UNIONSET_H
|
#define VCG_MATH_UNIONSET_H
|
||||||
|
|
||||||
|
#include <unordered_map>
|
||||||
// some stuff for portable hashes...
|
|
||||||
#ifdef WIN32
|
|
||||||
#ifndef __MINGW32__
|
|
||||||
#include <hash_map>
|
|
||||||
#include <hash_set>
|
|
||||||
#define STDEXT stdext
|
|
||||||
#else
|
|
||||||
#include <ext/hash_map>
|
|
||||||
#include <ext/hash_set>
|
|
||||||
#define STDEXT __gnu_cxx
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#include <ext/hash_map>
|
|
||||||
#include <ext/hash_set>
|
|
||||||
#define STDEXT __gnu_cxx
|
|
||||||
// It's terrible but gnu's hash_map needs an instantiation of hash() for
|
|
||||||
// every key type! So we cast the pointer to void*
|
|
||||||
namespace __gnu_cxx
|
|
||||||
{
|
|
||||||
template <> class hash<void *>: private hash<unsigned long>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
size_t operator()(const void *ptr) const { return hash<unsigned long>::operator()((unsigned long)ptr); }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
@ -83,21 +56,12 @@ namespace vcg
|
||||||
inline size_t operator ()(const ObjectPointer &p) const {return size_t(p);}
|
inline size_t operator ()(const ObjectPointer &p) const {return size_t(p);}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
std::unordered_map< OBJECT_TYPE*, int > inserted_objects;
|
||||||
STDEXT::hash_map< OBJECT_TYPE*, int > inserted_objects;
|
typedef typename std::unordered_map< OBJECT_TYPE*, int >::iterator hIterator;
|
||||||
typedef typename STDEXT::hash_map< ObjectPointer, int >::iterator hIterator;
|
|
||||||
#else
|
|
||||||
STDEXT::hash_map< OBJECT_TYPE*, int, SimpleObjHashFunc > inserted_objects;
|
|
||||||
typedef typename STDEXT::hash_map< ObjectPointer, int, SimpleObjHashFunc >::iterator hIterator;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef std::pair< hIterator, bool > hInsertResult;
|
typedef std::pair< hIterator, bool > hInsertResult;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* Default constructor
|
* Default constructor
|
||||||
|
|
Loading…
Reference in New Issue