diff options
author | George Marques <george@gmarqu.es> | 2016-06-10 14:57:56 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2016-06-10 15:43:07 -0300 |
commit | 269d5704202d29d1f367abfb2df44fa19997fd18 (patch) | |
tree | c5a795a163b42d7448cd7aa0cb15c1da1b605019 /core/vector.h | |
parent | f5aadad7ae58d2eec06e7b6fff29a9ca2d035063 (diff) |
Add 'from' argument to Array.find()
Diffstat (limited to 'core/vector.h')
-rw-r--r-- | core/vector.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/vector.h b/core/vector.h index 87248ccf68..cafb4a4aa3 100644 --- a/core/vector.h +++ b/core/vector.h @@ -120,7 +120,7 @@ public: template <class T_val> - int find(const T_val& p_val) const; + int find(const T_val& p_val, int p_from=0) const; void set(int p_index,T p_elem); T get(int p_index) const; @@ -238,13 +238,13 @@ void Vector<T>::_copy_on_write() { } template<class T> template<class T_val> -int Vector<T>::find(const T_val &p_val) const { +int Vector<T>::find(const T_val &p_val, int p_from) const { int ret = -1; - if (size() == 0) + if (p_from < 0 || size() == 0) return ret; - for (int i=0; i<size(); i++) { + for (int i=p_from; i<size(); i++) { if (operator[](i) == p_val) { ret = i; @@ -253,7 +253,7 @@ int Vector<T>::find(const T_val &p_val) const { }; return ret; -}; +} template<class T> Error Vector<T>::resize(int p_size) { |