diff options
author | Fred Hornsey <hornseyf@objectcomputing.com> | 2018-12-21 17:11:16 -0600 |
---|---|---|
committer | Fred Hornsey <hornseyf@objectcomputing.com> | 2018-12-21 17:11:16 -0600 |
commit | 38497d0e9a3ec28c47898fb6546158e54f25afca (patch) | |
tree | 640b7fb3c3cb51b3fd4f547f960a37922a8fbf69 | |
parent | 10983a559cf292c3c3255c869de8d024769cbe57 (diff) | |
download | ATCD-38497d0e9a3ec28c47898fb6546158e54f25afca.tar.gz |
Fix end() on ACE_Vector
It was based on the the base array, not the actual elements in the
array.
-rw-r--r-- | ACE/ace/Vector_T.h | 10 | ||||
-rw-r--r-- | ACE/ace/Vector_T.inl | 12 |
2 files changed, 22 insertions, 0 deletions
diff --git a/ACE/ace/Vector_T.h b/ACE/ace/Vector_T.h index 13c4ba0302d..a5be43470b5 100644 --- a/ACE/ace/Vector_T.h +++ b/ACE/ace/Vector_T.h @@ -188,6 +188,16 @@ public: void swap (ACE_Vector &rhs); + /* + * Implement our own end functions because Array_Base's end functions use the + * current capacity, not the Vector's actual element count! + */ + /// C++ Standard End Iterator + ///{ + typename ACE_Array_Base<T>::iterator end (); + typename ACE_Array_Base<T>::const_iterator end () const; + ///} + protected: /** diff --git a/ACE/ace/Vector_T.inl b/ACE/ace/Vector_T.inl index 81382438534..103bb93beec 100644 --- a/ACE/ace/Vector_T.inl +++ b/ACE/ace/Vector_T.inl @@ -45,6 +45,18 @@ void ACE_Vector<T, DEFAULT_SIZE>::pop_back (void) } } +template <class T, size_t DEFAULT_SIZE> ACE_INLINE +typename ACE_Array_Base<T>::iterator ACE_Vector<T, DEFAULT_SIZE>::end () +{ + return ACE_Array_Base<T>::array_ + length_; +} + +template <class T, size_t DEFAULT_SIZE> ACE_INLINE +typename ACE_Array_Base<T>::const_iterator ACE_Vector<T, DEFAULT_SIZE>::end () const +{ + return ACE_Array_Base<T>::array_ + length_; +} + // Compare this vector with <s> for inequality. template <class T, size_t DEFAULT_SIZE> ACE_INLINE bool |