Make all Pool*Array::operator[] as const

This is needed since that operator returns a local copy, not
an lvalue. Attempting to write to the return value of these operators
wouldn't change the array element. PoolVectors need locking when
writing, so this operator can't return a writable reference.

To update a Pool*Array, use the `set()` method which locks and unlocks
the array. For multiple writes, use the `write()` method which returns
a locked writable view, and unlocks when it goes out of scope.
This commit is contained in:
Gary Oberbrunner
2018-03-13 10:07:50 -04:00
parent 4a9e305776
commit a6689b2132
2 changed files with 14 additions and 14 deletions

View File

@@ -104,7 +104,7 @@ public:
void set(const int idx, const uint8_t data);
uint8_t operator [](const int idx);
const uint8_t operator [](const int idx);
int size() const;
@@ -200,7 +200,7 @@ public:
void set(const int idx, const int data);
int operator [](const int idx);
const int operator [](const int idx);
int size() const;
@@ -296,7 +296,7 @@ public:
void set(const int idx, const real_t data);
real_t operator [](const int idx);
const real_t operator [](const int idx);
int size() const;
@@ -392,7 +392,7 @@ public:
void set(const int idx, const String& data);
String operator [](const int idx);
const String operator [](const int idx);
int size() const;
@@ -489,7 +489,7 @@ public:
void set(const int idx, const Vector2& data);
Vector2 operator [](const int idx);
const Vector2 operator [](const int idx);
int size() const;
@@ -585,7 +585,7 @@ public:
void set(const int idx, const Vector3& data);
Vector3 operator [](const int idx);
const Vector3 operator [](const int idx);
int size() const;
@@ -681,7 +681,7 @@ public:
void set(const int idx, const Color& data);
Color operator [](const int idx);
const Color operator [](const int idx);
int size() const;