diff options
| author | David Kalnischkies <david@kalnischkies.de> | 2024-12-26 19:41:53 +0000 |
|---|---|---|
| committer | David Kalnischkies <david@kalnischkies.de> | 2025-01-05 22:16:08 +0000 |
| commit | f73593a4034d9eec0ec4466b8e173d4a4daece1f (patch) | |
| tree | 9cab47b9426e3e9fff80682b86f8449e3d9c9b53 /apt-pkg/cacheset.h | |
| parent | 427f95cedadb5323d35e5174d4592cbdd9c602f4 (diff) | |
Drop usage of macro APT_OVERRIDE for simple override
We were rather inconsistent in using it and as our public headers
contain deduction guides (a c++17 feature) it seems silly to try to hide
a c++11 feature in a macro, so lets stop this charade and drop the
macro and while we are changing all these lines lets apply [[nodiscard]]
(another c++17 feature) and other suggestions from clang-tidy and
formatting for a little more consistency.
Diffstat (limited to 'apt-pkg/cacheset.h')
| -rw-r--r-- | apt-pkg/cacheset.h | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h index 1c67a65d6..f3f3e967f 100644 --- a/apt-pkg/cacheset.h +++ b/apt-pkg/cacheset.h @@ -366,13 +366,13 @@ public: /*{{{*/ typedef typename Container::size_type size_type; typedef typename Container::allocator_type allocator_type; - bool insert(pkgCache::PkgIterator const &P) APT_OVERRIDE { if (P.end() == true) return false; _cont.insert(P); return true; } + bool insert(pkgCache::PkgIterator const &P) override { if (P.end() == true) return false; _cont.insert(P); return true; } template<class Cont> void insert(PackageContainer<Cont> const &pkgcont) { _cont.insert((typename Cont::const_iterator)pkgcont.begin(), (typename Cont::const_iterator)pkgcont.end()); } void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); } - bool empty() const APT_OVERRIDE { return _cont.empty(); } - void clear() APT_OVERRIDE { return _cont.clear(); } - size_t size() const APT_OVERRIDE { return _cont.size(); } + [[nodiscard]] bool empty() const override { return _cont.empty(); } + void clear() override { return _cont.clear(); } + [[nodiscard]] size_t size() const override { return _cont.size(); } #if __GNUC__ >= 5 || (__GNUC_MINOR__ >= 9 && __GNUC__ >= 4) iterator erase( const_iterator pos ) { return iterator(_cont.erase(pos._iter)); } iterator erase( const_iterator first, const_iterator last ) { return iterator(_cont.erase(first._iter, last._iter)); } @@ -658,9 +658,8 @@ public: typedef const_iterator::difference_type difference_type; typedef std::make_unsigned<const_iterator::difference_type>::type size_type; - - bool empty() const APT_OVERRIDE { return false; } - size_t size() const APT_OVERRIDE { return _cont->Head().PackageCount; } + [[nodiscard]] bool empty() const override { return false; } + [[nodiscard]] size_t size() const override { return _cont->Head().PackageCount; } const_iterator begin() const { return const_iterator(_cont->PkgBegin()); } const_iterator end() const { return const_iterator(_cont->PkgEnd()); } @@ -676,11 +675,11 @@ public: virtual ~PackageUniverse(); private: - APT_HIDDEN bool insert(pkgCache::PkgIterator const &) APT_OVERRIDE { return true; } + APT_HIDDEN bool insert(pkgCache::PkgIterator const &/*P*/) override { return true; } template<class Cont> APT_HIDDEN void insert(PackageContainer<Cont> const &) { } APT_HIDDEN void insert(const_iterator, const_iterator) { } - APT_HIDDEN void clear() APT_OVERRIDE { } + APT_HIDDEN void clear() override { } APT_HIDDEN iterator erase( const_iterator pos ); APT_HIDDEN iterator erase( const_iterator first, const_iterator last ); }; @@ -821,12 +820,12 @@ public: /*{{{*/ typedef typename Container::size_type size_type; typedef typename Container::allocator_type allocator_type; - bool insert(pkgCache::VerIterator const &V) APT_OVERRIDE { if (V.end() == true) return false; _cont.insert(V); return true; } + bool insert(pkgCache::VerIterator const &V) override { if (V.end() == true) return false; _cont.insert(V); return true; } template<class Cont> void insert(VersionContainer<Cont> const &vercont) { _cont.insert((typename Cont::const_iterator)vercont.begin(), (typename Cont::const_iterator)vercont.end()); } void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); } - bool empty() const APT_OVERRIDE { return _cont.empty(); } - void clear() APT_OVERRIDE { return _cont.clear(); } - size_t size() const APT_OVERRIDE { return _cont.size(); } + [[nodiscard]] bool empty() const override { return _cont.empty(); } + void clear() override { return _cont.clear(); } + [[nodiscard]] size_t size() const override { return _cont.size(); } #if APT_GCC_VERSION >= 0x409 iterator erase( const_iterator pos ) { return iterator(_cont.erase(pos._iter)); } iterator erase( const_iterator first, const_iterator last ) { return iterator(_cont.erase(first._iter, last._iter)); } |
