Made Vector::ptrw explicit for writing, compiler was sometimes using the wrong function,

leading to unnecesary copy on writes and reduced performance.
This commit is contained in:
Juan Linietsky
2017-11-25 00:07:54 -03:00
parent 7dfba3cda9
commit bc2e8d99e5
62 changed files with 148 additions and 147 deletions

View File

@@ -96,7 +96,7 @@ class Vector {
void _copy_on_write();
public:
_FORCE_INLINE_ T *ptr() {
_FORCE_INLINE_ T *ptrw() {
if (!_ptr) return NULL;
_copy_on_write();
return (T *)_get_data();
@@ -361,7 +361,7 @@ template <class T>
void Vector<T>::remove(int p_index) {
ERR_FAIL_INDEX(p_index, size());
T *p = ptr();
T *p = ptrw();
int len = size();
for (int i = p_index; i < len - 1; i++) {