diff --git a/vcg/container/container_allocation_table.h b/vcg/container/container_allocation_table.h index 435d344a..567cf13a 100644 --- a/vcg/container/container_allocation_table.h +++ b/vcg/container/container_allocation_table.h @@ -24,6 +24,10 @@ History $Log: not supported by cvs2svn $ +Revision 1.4 2004/04/05 18:20:50 ganovelli +Aggiunto typename +Eliminata bug di ricorsione nell'istanzazione dei template + Revision 1.3 2004/03/31 22:36:44 ganovelli First Working Release (with this comment) @@ -45,7 +49,7 @@ namespace vcg { template class CATBase{ public: -typedef typename STL_CONT::value_type ValueType; +typedef typename typename STL_CONT::value_type ValueType; virtual void Resort(ValueType*,ValueType*) =0; virtual void Remove(const STL_CONT&) = 0; @@ -64,7 +68,7 @@ static int & Id(){ template class CATEntry: public CATBase{ public: -typedef typename STL_CONT::value_type ValueType; +typedef typename typename STL_CONT::value_type ValueType; typedef typename ENTRY_TYPE EntryType; CATEntry(){if(Id()==0){ @@ -75,12 +79,12 @@ CATEntry(){if(Id()==0){ static unsigned int Ord(ValueType *); -static ENTRY_TYPE & GetEntry(STL_CONT::value_type*pt); +static ENTRY_TYPE & GetEntry(typename STL_CONT::value_type*pt); static void Insert( STL_CONT & c,bool cond=false ); // insert a vector to trace virtual void Remove( const STL_CONT & c); // remove the container c -static void RemoveIfEmpty( const STL_CONT & c); // remove the container c -static void Remove( ValueType * v); // remove the container that contains v +static void RemoveIfEmpty( const STL_CONT & c); // remove the container c +static void Remove( ValueType * v); // remove the container that contains v virtual void Resort( ValueType* old_start, // resort the allocation table ValueType* new_start); // after a container was moved @@ -105,7 +109,7 @@ static ValueType *& Upper() { return upper; // if the container next to the last accessed } -static std::list::iterator & Curr(){ // container that was last accessed +static typename std::list::iterator & Curr(){ // container that was last accessed static std::list::iterator currEntry; return currEntry; } @@ -114,9 +118,9 @@ static std::list::iterator & Curr(){ // container that was last ac static bool IsTheSameAsLast(ValueType *pt); // true if pt is in the container // that was accessed last static void Update(ValueType*); // set Upper() e Lower() -static std::list::iterator FindBase(const ValueType * pt); +static typename std::list::iterator FindBase(const ValueType * pt); // find the container that contains pt (naive) -virtual void AddDataElem(STL_CONT::value_type * pt,int n);// add n element to the auxiliary data +virtual void AddDataElem(typename STL_CONT::value_type * pt,int n);// add n element to the auxiliary data public: static int & Id(){ // unique identifier of the istance @@ -138,7 +142,7 @@ Ord(ValueType * pt) template -std::list::iterator CATEntry:: +typename std::list::iterator CATEntry:: FindBase(const ValueType * pt) { @@ -260,7 +264,7 @@ UTD() = false; template ENTRY_TYPE & CATEntry:: -GetEntry(STL_CONT::value_type*pt){ +GetEntry(typename STL_CONT::value_type*pt){ Update(pt); return *Curr(); } @@ -268,7 +272,7 @@ return *Curr(); template void CATEntry:: -AddDataElem(STL_CONT::value_type * pt,int n) +AddDataElem(typename STL_CONT::value_type * pt,int n) { Update(pt); Curr()->Push_back(n); @@ -280,7 +284,7 @@ Curr()->Push_back(n); // This class is used to implement optional core data (NormalOpt, CoordOpt etc...) template class CAT:public CATEntry >{ -typedef typename STL_CONT::value_type ValueType; +typedef typename typename STL_CONT::value_type ValueType; public: static ATTR_TYPE & Get(ValueType * pt); }; diff --git a/vcg/container/entries_allocation_table.h b/vcg/container/entries_allocation_table.h index ee0be613..7de6aa41 100644 --- a/vcg/container/entries_allocation_table.h +++ b/vcg/container/entries_allocation_table.h @@ -25,6 +25,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.4 2004/04/05 13:53:37 ganovelli +Aggiunto typename + Revision 1.3 2004/03/31 22:36:44 ganovelli First Working Release (with this comment) @@ -41,8 +44,8 @@ template struct EntryCATBase{ EntryCATBase(STL_CONT & _c):c(_c){}; -typename STL_CONT::value_type * Start() const; -virtual bool Empty(){}; +typename typename typename STL_CONT::value_type * Start() const; +virtual bool Empty(){return true;}; const STL_CONT * C(); virtual void Push_back(const int &){}; @@ -77,7 +80,7 @@ const bool EntryCATBase:: operator < (const EntryCATBase & o } template - STL_CONT::value_type * EntryCATBase::Start()const { + typename typename STL_CONT::value_type * EntryCATBase::Start()const { return &(*(c.begin())); } @@ -146,7 +149,7 @@ public: std::vector * Item(){return item;}; std::vector * item; - ATTR_TYPE & operator [](STL_CONT::value_type * v) + ATTR_TYPE & operator [](typename typename STL_CONT::value_type * v) { int pos = CATEntry >::Ord(v); return (*item)[pos];