diff --git a/vcg/container/container_allocation_table.h b/vcg/container/container_allocation_table.h index 303d970d..0b970972 100644 --- a/vcg/container/container_allocation_table.h +++ b/vcg/container/container_allocation_table.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.8 2006/06/08 20:28:57 ganovelli +aggiunto qualche const sui parametri + Revision 1.7 2005/10/15 16:21:48 ganovelli Working release (compilata solo su MSVC), vector_occ è migrato da component_opt @@ -82,7 +85,7 @@ static int & Id(){ }; /// CATEntry: first derivation templated on the type of entry -/// It implements all the methods to trace and access TVector element +/// It implements all the methods to trace and access vector_occ's elements template class CATEntry: public CATBase{ public: @@ -165,9 +168,6 @@ typename std::list::iterator CATEntry:: FindBase(const ValueType * pt) { -//DEBUG -int sz = AT().size(); -// std::list::iterator ite,curr_base,_; ite = AT().begin(); curr_base = AT().end(); @@ -270,7 +270,7 @@ Insert( STL_CONT & c,bool cond ) { ENTRY_TYPE entry(c); std::list::iterator lower_ite,upper_ite; -upper_ite = FindBase(&*c.begin()); +upper_ite = FindBase( c.Pointer2begin()); bool isIn = (upper_ite != AT().end()); if(isIn){ if((*upper_ite).C() != &c ) diff --git a/vcg/container/entries_allocation_table.h b/vcg/container/entries_allocation_table.h index 7de6aa41..fcb441bb 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.5 2005/07/06 15:28:11 ganovelli +aggiornamento di alcuni path + Revision 1.4 2004/04/05 13:53:37 ganovelli Aggiunto typename @@ -81,7 +84,7 @@ const bool EntryCATBase:: operator < (const EntryCATBase & o template typename typename STL_CONT::value_type * EntryCATBase::Start()const { - return &(*(c.begin())); + return c.Pointer2begin(); } template diff --git a/vcg/container/vector_occ.h b/vcg/container/vector_occ.h index 3732c9c7..0c2ec9b2 100644 --- a/vcg/container/vector_occ.h +++ b/vcg/container/vector_occ.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.2 2006/06/08 20:28:38 ganovelli +Corretto IsEnabledAttribute + Revision 1.1 2005/10/15 16:21:49 ganovelli Working release (compilata solo su MSVC), vector_occ è migrato da component_opt @@ -62,10 +65,12 @@ class vector_occ: public std::vector{ typedef typename vector_occ ThisType; public: - vector_occ():std::vector(){reserve(1);} + vector_occ():std::vector(){id = ID(); ID()=ID()+1; reserve(1);} ~vector_occ(); - + VALUE_TYPE * Pointer2begin(){ + if(empty()) return (VALUE_TYPE *)id; else return &*std::vector::begin(); + } std::list < CATBase* > attributes; // override di tutte le funzioni che possono spostare // l'allocazione in memoria del container @@ -120,7 +125,7 @@ public: TempData NewTempData(){ typedef typename CATEntry >::EntryType EntryTypeMulti; CATEntry::Insert(*this); - EntryTypeMulti entry = CATEntry::GetEntry(&*begin()); + EntryTypeMulti entry = CATEntry::GetEntry(Pointer2begin()); entry.Data().push_back(new Wrap< ATTR_TYPE>); ((Wrap*)entry.Data().back())->reserve(capacity()); @@ -135,7 +140,7 @@ public: typedef typename CATEntry >::EntryType EntryTypeMulti; CATEntry::RemoveIfEmpty(*this); EntryTypeMulti - entry = CATEntry >::GetEntry(&*begin()); + entry = CATEntry >::GetEntry(Pointer2begin); entry.Data().remove((Wrap*)td.Item()); delete ((Wrap*)td.Item()); @@ -144,6 +149,8 @@ public: private: VALUE_TYPE * old_start; + int id; + static int & ID(){static int id; return id;} void Update(); }; @@ -184,11 +191,11 @@ template void vector_occ:: Update(){ std::list < CATBase * >::iterator ia; - if(&(*begin()) != old_start) + if(Pointer2begin() != old_start) for(ia = attributes.begin(); ia != attributes.end(); ++ia) - (*ia)->Resort(old_start,&(*begin())); + (*ia)->Resort(old_start,Pointer2begin()); - old_start = &(*begin()); + old_start = Pointer2begin(); }