summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcache.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-07-13 23:10:53 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-08-10 17:27:18 +0200
commit3707fd4faab3f2e2521263070b68fd0afaae2900 (patch)
treee0730218bbd83e2631f657dd0b39156f602fa065 /apt-pkg/pkgcache.cc
parent9112f77703c39d46e2e0471c48c8a5e1f93f4abf (diff)
avoid virtual in the iterators
With a bit of trickery and the Curiously recurring template pattern we can free us from our use of virtual in the iterators were it is unneeded bloat as we never deal with pointers to iterators and similar such. Git-Dch: Ignore
Diffstat (limited to 'apt-pkg/pkgcache.cc')
-rw-r--r--apt-pkg/pkgcache.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index ae04bc699..aebbffe8b 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -411,7 +411,7 @@ pkgCache::PkgIterator pkgCache::GrpIterator::NextPkg(pkgCache::PkgIterator const
// GrpIterator::operator ++ - Postfix incr /*{{{*/
// ---------------------------------------------------------------------
/* This will advance to the next logical group in the hash table. */
-void pkgCache::GrpIterator::operator ++(int)
+pkgCache::GrpIterator& pkgCache::GrpIterator::operator++()
{
// Follow the current links
if (S != Owner->GrpP)
@@ -423,12 +423,13 @@ void pkgCache::GrpIterator::operator ++(int)
HashIndex++;
S = Owner->GrpP + Owner->HeaderP->GrpHashTableP()[HashIndex];
}
+ return *this;
}
/*}}}*/
// PkgIterator::operator ++ - Postfix incr /*{{{*/
// ---------------------------------------------------------------------
/* This will advance to the next logical package in the hash table. */
-void pkgCache::PkgIterator::operator ++(int)
+pkgCache::PkgIterator& pkgCache::PkgIterator::operator ++()
{
// Follow the current links
if (S != Owner->PkgP)
@@ -440,6 +441,7 @@ void pkgCache::PkgIterator::operator ++(int)
HashIndex++;
S = Owner->PkgP + Owner->HeaderP->PkgHashTableP()[HashIndex];
}
+ return *this;
}
/*}}}*/
// PkgIterator::State - Check the State of the package /*{{{*/
@@ -685,7 +687,7 @@ void pkgCache::DepIterator::GlobOr(DepIterator &Start,DepIterator &End)
for (bool LastOR = true; end() == false && LastOR == true;)
{
LastOR = (S->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or;
- (*this)++;
+ ++(*this);
if (LastOR == true)
End = (*this);
}