--- queensgui/src/containerhash.cpp 2007/07/19 23:44:01 4 +++ queensgui/src/containerhash.cpp 2007/07/20 09:54:09 6 @@ -19,6 +19,7 @@ ***************************************************************************/ #include "containerhash.h" + ContainerHash::ContainerHash(GUIUpdate* update) : SolutionContainer(update) { @@ -33,6 +34,10 @@ ContainerHash::~ContainerHash() { + for (int i=0; iend(); - solutions[i]->splice(p, *solutions[base+1] ); - */ - - ListIt p = solutions[i]->end(); solutions[i]->splice(p, *solutions[base2]); } m_hashroof /= 2; @@ -101,7 +98,9 @@ if (m_halt) return; match_count = 0; - Solution* tmp = (*i)->copy(); + + std::auto_ptr tmp( (*i).get()->copy() ); + if (mirror) tmp->mirror(); for (int k=0;kend();j++) { - if ( *tmp == *(*j) ) { + for ( ; j!=solutions[bucket]->end();j++) + { + if ( *tmp == *(*j) ) + { solutions[bucket]->erase(j); break; } @@ -119,42 +120,12 @@ } } - -/* BACKUP -void ContainerHash::uniqueSolutionsWorker(int rot,bool mirror) -{ - int match_count; - - unique = true; - if (total == -1) - total = solutions.size(); - - for (ListIt i=solutions.begin(); i != solutions.end(); i++) { - match_count = 0; - Solution tmp(*i); - if (mirror) - tmp.mirror(); - for (int k=0;kpush_back(sol); + solutions[hash]->push_back( boost::shared_ptr(sol) ); m_size++; + } Solution* ContainerHash::solution(int index) @@ -166,6 +137,6 @@ break; } } - return *it; + return (*it).get(); }