From: Alex Rousskov Date: Tue, 6 Sep 2011 18:03:10 +0000 (-0600) Subject: Added a Vector::front() method, to mimic std::vector and other STL containers. X-Git-Tag: take08~24^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d66e30b4c97929ecb8ddc0177c72f7ca2e3faa41;p=thirdparty%2Fsquid.git Added a Vector::front() method, to mimic std::vector and other STL containers. --- diff --git a/include/Array.h b/include/Array.h index 17c312a0fb..d54620b9d1 100644 --- a/include/Array.h +++ b/include/Array.h @@ -97,6 +97,8 @@ public: Vector &operator += (E item) {push_back(item); return *this;}; void insert (E); + const E &front() const; + E &front(); E &back(); E pop_back(); E shift(); // aka pop_front @@ -250,6 +252,22 @@ Vector::back() return items[size() - 1]; } +template +const E & +Vector::front() const +{ + assert (size()); + return items[0]; +} + +template +E & +Vector::front() +{ + assert (size()); + return items[0]; +} + template void Vector::prune(E item)