diff options
author | Wilson E. Alvarez <wilson.e.alvarez1@gmail.com> | 2017-08-12 07:04:30 -0400 |
---|---|---|
committer | Wilson E. Alvarez <wilson.e.alvarez1@gmail.com> | 2017-08-14 13:28:06 -0400 |
commit | 21d281c4a953404c8f13e1cb7ee8d4cf9c25bb4c (patch) | |
tree | 2a4144fca78e6fc84efec7583297f6d8dcea9614 /core/vector.h | |
parent | 9575dbdf788e8a5154b3ec2f66913e731ac02850 (diff) | |
download | redot-engine-21d281c4a953404c8f13e1cb7ee8d4cf9c25bb4c.tar.gz |
Use const reference where favorable
Diffstat (limited to 'core/vector.h')
-rw-r--r-- | core/vector.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/vector.h b/core/vector.h index 5eed8dce96..9f523c567c 100644 --- a/core/vector.h +++ b/core/vector.h @@ -117,7 +117,7 @@ public: } _FORCE_INLINE_ bool empty() const { return _ptr == 0; } Error resize(int p_size); - bool push_back(T p_elem); + bool push_back(const T &p_elem); void remove(int p_index); void erase(const T &p_val) { @@ -129,7 +129,7 @@ public: template <class T_val> int find(const T_val &p_val, int p_from = 0) const; - void set(int p_index, T p_elem); + void set(int p_index, const T &p_elem); T get(int p_index) const; inline T &operator[](int p_index) { @@ -336,7 +336,7 @@ void Vector<T>::invert() { } template <class T> -void Vector<T>::set(int p_index, T p_elem) { +void Vector<T>::set(int p_index, const T &p_elem) { operator[](p_index) = p_elem; } @@ -348,7 +348,7 @@ T Vector<T>::get(int p_index) const { } template <class T> -bool Vector<T>::push_back(T p_elem) { +bool Vector<T>::push_back(const T &p_elem) { Error err = resize(size() + 1); ERR_FAIL_COND_V(err, true) |