From 21d281c4a953404c8f13e1cb7ee8d4cf9c25bb4c Mon Sep 17 00:00:00 2001 From: "Wilson E. Alvarez" Date: Sat, 12 Aug 2017 07:04:30 -0400 Subject: Use const reference where favorable --- core/vector.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core/vector.h') 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 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::invert() { } template -void Vector::set(int p_index, T p_elem) { +void Vector::set(int p_index, const T &p_elem) { operator[](p_index) = p_elem; } @@ -348,7 +348,7 @@ T Vector::get(int p_index) const { } template -bool Vector::push_back(T p_elem) { +bool Vector::push_back(const T &p_elem) { Error err = resize(size() + 1); ERR_FAIL_COND_V(err, true) -- cgit v1.2.3