summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/cacheiterators.h1
-rw-r--r--apt-pkg/cacheset.h30
-rw-r--r--cmdline/apt-mark.cc2
3 files changed, 17 insertions, 16 deletions
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index f3b107699..d7614374e 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -77,7 +77,6 @@ template<typename Str, typename Itr> class pkgCache::Iterator :
inline pkgCache *Cache() const {return Owner;}
// Mixed stuff
- inline void operator =(const Itr &B) {S = B.S; Owner = B.Owner;}
inline bool IsGood() const { return S && Owner && ! end();}
inline unsigned long Index() const {return S - OwnerPointer();}
diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h
index 4fe1eba87..29f7540ca 100644
--- a/apt-pkg/cacheset.h
+++ b/apt-pkg/cacheset.h
@@ -346,13 +346,10 @@ public: /*{{{*/
bool empty() const { return _cont.empty(); }
void clear() { return _cont.clear(); }
- //FIXME: on ABI break, replace the first with the second without bool
- void erase(iterator position) { _cont.erase((typename Container::iterator)position); }
- iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); }
- size_t erase(const pkgCache::PkgIterator x) { return _cont.erase(x); }
- void erase(iterator first, iterator last) { _cont.erase(first, last); }
size_t size() const { return _cont.size(); }
-
+ iterator erase( iterator pos ) { return iterator(_cont.erase(pos)); }
+ iterator erase( iterator first, iterator last ) { return iterator(_cont.erase(first, last)); }
+ size_t erase(pkgCache::PkgIterator const & P) { size_t oldsize = size(); _cont.erase(std::remove(_cont.begin(), _cont.end(), P), _cont.end()); return oldsize - size(); }
const_iterator begin() const { return const_iterator(_cont.begin()); }
const_iterator end() const { return const_iterator(_cont.end()); }
iterator begin() { return iterator(_cont.begin()); }
@@ -578,9 +575,9 @@ private:
void insert(const_iterator, const_iterator) { }
void clear() { }
- iterator& erase(iterator &iter) { return iter; }
- size_t erase(const pkgCache::PkgIterator) { return 0; }
- void erase(iterator, iterator) { }
+ iterator erase( iterator pos );
+ iterator erase( iterator first, iterator last );
+ size_t erase(pkgCache::PkgIterator const & P);
};
/*}}}*/
typedef PackageContainer<std::set<pkgCache::PkgIterator> > PackageSet;
@@ -780,12 +777,10 @@ public: /*{{{*/
void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }
bool empty() const { return _cont.empty(); }
void clear() { return _cont.clear(); }
- //FIXME: on ABI break, replace the first with the second without bool
- void erase(iterator position) { _cont.erase((typename Container::iterator)position); }
- iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); }
- size_t erase(const pkgCache::VerIterator x) { return _cont.erase(x); }
- void erase(iterator first, iterator last) { _cont.erase(first, last); }
size_t size() const { return _cont.size(); }
+ iterator erase( iterator pos ) { return iterator(_cont.erase(pos)); }
+ iterator erase( iterator first, iterator last ) { return iterator(_cont.erase(first, last)); }
+ size_t erase(pkgCache::VerIterator const & V) { size_t oldsize = size(); _cont.erase(std::remove(_cont.begin(), _cont.end(), V), _cont.end()); return oldsize - size(); }
const_iterator begin() const { return const_iterator(_cont.begin()); }
const_iterator end() const { return const_iterator(_cont.end()); }
@@ -989,6 +984,13 @@ template<> inline void VersionContainer<std::vector<pkgCache::VerIterator> >::in
}
/*}}}*/
+template<> inline size_t PackageContainer<std::set<pkgCache::PkgIterator> >::erase(pkgCache::PkgIterator const &P) {
+ return _cont.erase(P);
+}
+template<> inline size_t VersionContainer<std::set<pkgCache::VerIterator> >::erase(pkgCache::VerIterator const &V) {
+ return _cont.erase(V);
+}
+
template<> template<class Compare> inline bool VersionContainer<std::vector<pkgCache::VerIterator> >::sort(Compare Comp) {
std::sort(_cont.begin(), _cont.end(), Comp);
return true;
diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc
index de1c80309..02c73fc2e 100644
--- a/cmdline/apt-mark.cc
+++ b/cmdline/apt-mark.cc
@@ -238,7 +238,7 @@ static bool DoHold(CommandLine &CmdL)
ioprintf(c1out,_("%s was already set on hold.\n"), Pkg.FullName(true).c_str());
else
ioprintf(c1out,_("%s was already not hold.\n"), Pkg.FullName(true).c_str());
- Pkg = pkgset.erase(Pkg, true);
+ Pkg = pkgset.erase(Pkg);
}
else
++Pkg;