mirror of
https://github.com/thunderbrewhq/squall.git
synced 2026-02-04 00:49:08 +00:00
feat(array): add const qualified TSBaseArray::operator[]
This commit is contained in:
parent
cf433ff1f3
commit
5cdbd74e01
1 changed files with 7 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ class TSBaseArray {
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
T& operator[](uint32_t index);
|
T& operator[](uint32_t index);
|
||||||
|
const T& operator[](uint32_t index) const;
|
||||||
void CheckArrayBounds(uint32_t index) const;
|
void CheckArrayBounds(uint32_t index) const;
|
||||||
void Constructor();
|
void Constructor();
|
||||||
uint32_t Count() const;
|
uint32_t Count() const;
|
||||||
|
|
@ -33,6 +34,12 @@ T& TSBaseArray<T>::operator[](uint32_t index) {
|
||||||
return this->m_data[index];
|
return this->m_data[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
const T& TSBaseArray<T>::operator[](uint32_t index) const {
|
||||||
|
this->CheckArrayBounds(index);
|
||||||
|
return this->m_data[index];
|
||||||
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void TSBaseArray<T>::CheckArrayBounds(uint32_t index) const {
|
void TSBaseArray<T>::CheckArrayBounds(uint32_t index) const {
|
||||||
if (index < this->Count()) {
|
if (index < this->Count()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue