Преглед на файлове

Merge pull request #284 from chaigler/vector_contains_fix

Implements Vector::contains() method
Peter Robinson преди 9 години
родител
ревизия
6aaf44076e
променени са 1 файла, в които са добавени 5 реда и са изтрити 0 реда
  1. 5 0
      engine/source/collection/vector.h

+ 5 - 0
engine/source/collection/vector.h

@@ -456,6 +456,11 @@ template<class T> inline bool Vector<T>::empty() const
    return (mElementCount == 0);
    return (mElementCount == 0);
 }
 }
 
 
+template<class T> inline bool Vector<T>::contains(const T& t) const
+{
+    return find_next(t) != -1;
+}
+
 template<class T> inline void Vector<T>::insert(iterator p,const T& x)
 template<class T> inline void Vector<T>::insert(iterator p,const T& x)
 {
 {
    U32 index = (U32) (p - mArray);
    U32 index = (U32) (p - mArray);