summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2022-05-06 16:20:00 +0000
committerJulian Andres Klode <jak@debian.org>2022-05-06 16:20:00 +0000
commit6778e2d672d84c962a578f6de415c666b9cf6ee1 (patch)
treee3b7db9a4a32a76f76ed3000b411d2d38ae2f4eb
parent51bcb140eacd3c42b2b82d3d8946bf236858bbf1 (diff)
parent84f5ff06f0c7dbe10f5ec8452521bd79262bc05b (diff)
Merge branch 'pu/gcc-12' into 'main'
Avoid use of deprecated std::iterator (twice) See merge request apt-team/apt!232
-rw-r--r--apt-pkg/cacheiterators.h9
-rw-r--r--apt-pkg/cacheset.h6
2 files changed, 12 insertions, 3 deletions
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index 466492442..9273369bd 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -44,8 +44,7 @@
// abstract Iterator template /*{{{*/
/* This template provides the very basic iterator methods we
need to have for doing some walk-over-the-cache magic */
-template<typename Str, typename Itr> class APT_PUBLIC pkgCache::Iterator :
- public std::iterator<std::forward_iterator_tag, Str> {
+template<typename Str, typename Itr> class APT_PUBLIC pkgCache::Iterator {
/** \brief Returns the Pointer for this struct in the owner
* The implementation of this method should be pretty short
* as it will only return the Pointer into the mmap stored
@@ -61,6 +60,12 @@ template<typename Str, typename Itr> class APT_PUBLIC pkgCache::Iterator :
pkgCache *Owner;
public:
+ // iterator_traits
+ using iterator_category = std::forward_iterator_tag;
+ using value_type = Str;
+ using difference_type = std::ptrdiff_t;
+ using pointer = Str*;
+ using reference = Str&;
// Iteration
inline bool end() const {return Owner == 0 || S == OwnerPointer();}
diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h
index 383d26b76..4ea78bcae 100644
--- a/apt-pkg/cacheset.h
+++ b/apt-pkg/cacheset.h
@@ -203,12 +203,16 @@ private:
}; /*}}}*/
// Iterator templates for our Containers /*{{{*/
template<typename Interface, typename Master, typename iterator_type, typename container_iterator, typename container_value> class Container_iterator_base :
- public std::iterator<typename std::iterator_traits<container_iterator>::iterator_category, container_value>,
public Interface::template iterator_base<iterator_type>
{
protected:
container_iterator _iter;
public:
+ using iterator_category = typename std::iterator_traits<container_iterator>::iterator_category;
+ using value_type = container_value;
+ using difference_type = std::ptrdiff_t;
+ using pointer = container_value*;
+ using reference = container_value&;
explicit Container_iterator_base(container_iterator const &i) : _iter(i) {}
inline container_value operator*(void) const { return static_cast<iterator_type const*>(this)->getType(); };
operator container_iterator(void) const { return _iter; }