From 62ca61ff4ac794f9c42335d8286343149d4313d1 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 26 Feb 2020 18:46:06 +0100 Subject: cacheset: Fix -Wdeprecated-copy warnings Remove the operator= from Container_iterator, as it was basically just the default anyway, and add copy constructors to *Interface that match their operator=. Tried adding copy constructor to Container_iterator, but that only made things worse. --- apt-pkg/cacheset.cc | 4 ++++ apt-pkg/cacheset.h | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc index ae1d5ee3e..288180f16 100644 --- a/apt-pkg/cacheset.cc +++ b/apt-pkg/cacheset.cc @@ -915,6 +915,7 @@ CacheSetHelper::CacheSetHelper(bool const ShowError, GlobalError::MsgType ErrorT CacheSetHelper::~CacheSetHelper() {} PackageContainerInterface::PackageContainerInterface() : ConstructedBy(CacheSetHelper::UNKNOWN), d(NULL) {} +PackageContainerInterface::PackageContainerInterface(PackageContainerInterface const &by) : PackageContainerInterface() { *this = by; } PackageContainerInterface::PackageContainerInterface(CacheSetHelper::PkgSelector const by) : ConstructedBy(by), d(NULL) {} PackageContainerInterface& PackageContainerInterface::operator=(PackageContainerInterface const &other) { if (this != &other) @@ -928,6 +929,9 @@ PackageUniverse::PackageUniverse(pkgCacheFile * const Owner) : _cont(Owner->GetP PackageUniverse::~PackageUniverse() {} VersionContainerInterface::VersionContainerInterface() : d(NULL) {} +VersionContainerInterface::VersionContainerInterface(VersionContainerInterface const &other) : VersionContainerInterface() { + *this = other; +}; VersionContainerInterface& VersionContainerInterface::operator=(VersionContainerInterface const &) { return *this; } diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h index 6023b861d..bfb9e0abf 100644 --- a/apt-pkg/cacheset.h +++ b/apt-pkg/cacheset.h @@ -201,7 +201,7 @@ template(this)->getType(); }; operator container_iterator(void) const { return _iter; } inline iterator_type& operator++() { ++_iter; return static_cast(*this); } @@ -241,12 +241,10 @@ template class Container_iterato typedef Container_iterator iterator_type; typedef typename Container::iterator container_iterator; public: - explicit Container_iterator(container_iterator i) : + explicit Container_iterator(container_iterator const &i) : Container_iterator_base(i) {} operator typename Master::const_iterator() { return typename Master::const_iterator(this->_iter); } - inline iterator_type& operator=(iterator_type const &i) { this->_iter = i._iter; return static_cast(*this); } - inline iterator_type& operator=(container_iterator const &i) { this->_iter = i; return static_cast(*this); } inline typename Container::iterator::reference operator*(void) const { return *this->_iter; } inline typename Container::value_type getType(void) const { return *this->_iter; } @@ -325,6 +323,7 @@ public: CacheSetHelper::PkgSelector getConstructor() const { return ConstructedBy; } PackageContainerInterface(); explicit PackageContainerInterface(CacheSetHelper::PkgSelector const by); + PackageContainerInterface(PackageContainerInterface const &by); PackageContainerInterface& operator=(PackageContainerInterface const &other); virtual ~PackageContainerInterface(); @@ -762,6 +761,7 @@ public: CacheSetHelper &helper); VersionContainerInterface(); + VersionContainerInterface(VersionContainerInterface const &other); VersionContainerInterface& operator=(VersionContainerInterface const &other); virtual ~VersionContainerInterface(); private: -- cgit v1.2.3-70-g09d2