From 7635093c1c015e385a9e72bdd8a089fd9d48ab57 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 9 Jul 2010 19:51:19 +0200 Subject: switch from std::set to std::vector as it is way more simple, a bit faster and still provides everything we need for the Cache generator --- apt-pkg/pkgcachegen.cc | 16 ++++++++-------- apt-pkg/pkgcachegen.h | 12 +++++------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 7ca8fbfda..1175d5129 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -36,7 +36,7 @@ #include /*}}}*/ typedef vector::iterator FileIterator; -template std::set pkgCacheGenerator::Dynamic::toReMap; +template std::vector pkgCacheGenerator::Dynamic::toReMap(6); // CacheGenerator::pkgCacheGenerator - Constructor /*{{{*/ // --------------------------------------------------------------------- @@ -113,25 +113,25 @@ void pkgCacheGenerator::ReMap(void const * const oldMap, void const * const newM if (UniqHash[i] != 0) UniqHash[i] += (pkgCache::StringItem*) newMap - (pkgCache::StringItem*) oldMap; - for (std::set::const_iterator i = Dynamic::toReMap.begin(); + for (std::vector::const_iterator i = Dynamic::toReMap.begin(); i != Dynamic::toReMap.end(); ++i) (*i)->ReOwn(Cache, oldMap, newMap); - for (std::set::const_iterator i = Dynamic::toReMap.begin(); + for (std::vector::const_iterator i = Dynamic::toReMap.begin(); i != Dynamic::toReMap.end(); ++i) (*i)->ReOwn(Cache, oldMap, newMap); - for (std::set::const_iterator i = Dynamic::toReMap.begin(); + for (std::vector::const_iterator i = Dynamic::toReMap.begin(); i != Dynamic::toReMap.end(); ++i) (*i)->ReOwn(Cache, oldMap, newMap); - for (std::set::const_iterator i = Dynamic::toReMap.begin(); + for (std::vector::const_iterator i = Dynamic::toReMap.begin(); i != Dynamic::toReMap.end(); ++i) (*i)->ReOwn(Cache, oldMap, newMap); - for (std::set::const_iterator i = Dynamic::toReMap.begin(); + for (std::vector::const_iterator i = Dynamic::toReMap.begin(); i != Dynamic::toReMap.end(); ++i) (*i)->ReOwn(Cache, oldMap, newMap); - for (std::set::const_iterator i = Dynamic::toReMap.begin(); + for (std::vector::const_iterator i = Dynamic::toReMap.begin(); i != Dynamic::toReMap.end(); ++i) (*i)->ReOwn(Cache, oldMap, newMap); - for (std::set::const_iterator i = Dynamic::toReMap.begin(); + for (std::vector::const_iterator i = Dynamic::toReMap.begin(); i != Dynamic::toReMap.end(); ++i) (*i)->ReOwn(Cache, oldMap, newMap); } /*}}}*/ diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index 20dd28030..ff198833a 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -23,7 +23,7 @@ #include #include -#include +#include class pkgSourceList; class OpProgress; @@ -46,16 +46,14 @@ class pkgCacheGenerator /*{{{*/ friend class ListParser; template class Dynamic { - Iter *I; - public: - static std::set toReMap; - Dynamic(Iter &It) : I(&It) { - toReMap.insert(I); + static std::vector toReMap; + Dynamic(Iter &I) { + toReMap.push_back(&I); } ~Dynamic() { - toReMap.erase(I); + toReMap.pop_back(); } }; -- cgit v1.2.3