From 2c1e4917d9fac693033723742ec5d4d76fd74c76 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 30 Oct 2015 14:54:18 +0100 Subject: cacheset: Fix compilation on new GCC in C++98 mode Since gcc 4.9, the API for erase slightly changed. In commit 3dddcdf2432e78f37c74d8c76c2c519a8d935ab2 the existing checks for __cplusplus where changed to check the gcc version, as the __cplusplus check did nothing, because gcc 4.8 already provided the standard value in there. Fix the code to check for the gcc version in two more places, and change the existing checks to use a convenience macro. --- apt-pkg/cacheset.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'apt-pkg/cacheset.h') diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h index 7c03ad97a..ca0294545 100644 --- a/apt-pkg/cacheset.h +++ b/apt-pkg/cacheset.h @@ -644,7 +644,7 @@ template<> inline void PackageContainer >::in for (const_iterator p = begin; p != end; ++p) _cont.push_back(*p); } -#if __cplusplus < 201103L +#if APT_GCC_VERSION < 0x409 template<> inline PackageContainer >::iterator PackageContainer >::erase(iterator i) { _cont.erase(i._iter); return end(); @@ -897,7 +897,7 @@ public: /*{{{*/ bool empty() const APT_OVERRIDE { return _cont.empty(); } void clear() APT_OVERRIDE { return _cont.clear(); } size_t size() const APT_OVERRIDE { return _cont.size(); } -#if __GNUC__ >= 5 || (__GNUC_MINOR__ >= 9 && __GNUC__ >= 4) +#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)); } #else @@ -1148,7 +1148,7 @@ template<> inline void VersionContainer >::in for (const_iterator v = begin; v != end; ++v) _cont.push_back(*v); } -#if __cplusplus < 201103L +#if APT_GCC_VERSION < 0x409 template<> inline VersionContainer >::iterator VersionContainer >::erase(iterator i) { _cont.erase(i._iter); return end(); -- cgit v1.2.3