From 87cd380e9a0616491644f95664ecce58925d5965 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Wed, 7 Nov 2012 14:43:16 +1300 Subject: [PATCH] Polish: improve const correctness on Squid vector<> implementation This update allows == and != operators to be used with const_iterator and removes the need for many implicit conversions safely. --- include/Array.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/Array.h b/include/Array.h index 8cee5fa144..8b083b1cc1 100644 --- a/include/Array.h +++ b/include/Array.h @@ -52,8 +52,8 @@ public: VectorIteratorBase(C &); VectorIteratorBase(size_t, C &); VectorIteratorBase & operator =(VectorIteratorBase const &); - bool operator != (VectorIteratorBase const &rhs); - bool operator == (VectorIteratorBase const &rhs); + bool operator != (VectorIteratorBase const &rhs) const; + bool operator == (VectorIteratorBase const &rhs) const; VectorIteratorBase & operator ++(); VectorIteratorBase operator ++(int); typename C::value_type & operator *() const { @@ -386,14 +386,14 @@ template VectorIteratorBase::VectorIteratorBase(size_t aPos, C &container) : pos(aPos), theVector(&container) {} template -bool VectorIteratorBase:: operator != (VectorIteratorBase const &rhs) +bool VectorIteratorBase:: operator != (VectorIteratorBase const &rhs) const { assert (theVector); return pos != rhs.pos; } template -bool VectorIteratorBase:: operator == (VectorIteratorBase const &rhs) +bool VectorIteratorBase:: operator == (VectorIteratorBase const &rhs) const { assert (theVector); return pos == rhs.pos; -- 2.47.3