Re-adapted to ms compilers

This commit is contained in:
Paolo Cignoni 2006-05-26 10:18:11 +00:00
parent 0102ac5f9f
commit 6ffc992641
1 changed files with 23 additions and 16 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.9 2006/05/25 09:37:14 cignoni
Many changes for the different interpretation of hash_set between gcc and .net. Probably to be completed.
Revision 1.8 2006/05/24 16:42:22 m_di_benedetto Revision 1.8 2006/05/24 16:42:22 m_di_benedetto
Corrected bbox inflation amount in case of _cellsize != 0 Corrected bbox inflation amount in case of _cellsize != 0
@ -100,18 +103,15 @@ public:
operator size_t () const operator size_t () const
{return Hash();} {return Hash();}
}; };
}}
namespace STDEXT // needed for gcc compilation
{ #ifndef _MSC_VER
template <> }} namespace STDEXT {
struct hash<vcg::tri::HashedPoint3i>{ template <> struct hash<vcg::tri::HashedPoint3i>{
inline size_t operator ()(const vcg::tri::HashedPoint3i &p) const {return size_t(p);} inline size_t operator ()(const vcg::tri::HashedPoint3i &p) const {return size_t(p);}
}; };
} namespace vcg{ namespace tri{
} #endif
namespace vcg{
namespace tri{
// //
template<class MeshType> template<class MeshType>
@ -193,10 +193,6 @@ class Clustering
} }
}; };
struct SimpleTriHashFunc{
inline size_t operator ()(const SimpleTri &p) const {return size_t(p);}
};
// The init function Take two parameters // The init function Take two parameters
// _size is the approximate total number of cells composing the grid surrounding the objects (usually a large number) // _size is the approximate total number of cells composing the grid surrounding the objects (usually a large number)
@ -231,7 +227,18 @@ class Clustering
BasicGrid<CellType,ScalarType> Grid; BasicGrid<CellType,ScalarType> Grid;
#ifdef _MSC_VER
STDEXT::hash_set<SimpleTri> TriSet;
typedef typename STDEXT::hash_set<SimpleTri>::iterator TriHashSetIterator;
#else
struct SimpleTriHashFunc{
inline size_t operator ()(const SimpleTri &p) const {return size_t(p);}
};
STDEXT::hash_set<SimpleTri,SimpleTriHashFunc> TriSet; STDEXT::hash_set<SimpleTri,SimpleTriHashFunc> TriSet;
typedef typename STDEXT::hash_set<SimpleTri,SimpleTriHashFunc>::iterator TriHashSetIterator;
#endif
STDEXT::hash_map<HashedPoint3i,CellType> GridCell; STDEXT::hash_map<HashedPoint3i,CellType> GridCell;
void Add(MeshType &m) void Add(MeshType &m)
@ -280,7 +287,7 @@ class Clustering
++i; ++i;
} }
Allocator<MeshType>::AddFaces(m,TriSet.size()); Allocator<MeshType>::AddFaces(m,TriSet.size());
typename STDEXT::hash_set<SimpleTri,SimpleTriHashFunc>::iterator ti; TriHashSetIterator ti;
i=0; i=0;
for(ti=TriSet.begin();ti!=TriSet.end();++ti) for(ti=TriSet.begin();ti!=TriSet.end();++ti)
{ {