diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-07-20 19:40:51 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-07-20 19:40:51 +0100 |
| commit | 9a3b4167bb8495f9422ffa5cb242198fed3a315b (patch) | |
| tree | d5e1f4fe1ff66282cb67896c7c432a487b5a55df /src/array.cpp | |
| parent | 13bc6eeea4cc89b06bcfc3aaef7bfb85c1cb5b01 (diff) | |
Fix polymorphic element types usage; Empty `union` as opaque type
Diffstat (limited to 'src/array.cpp')
| -rw-r--r-- | src/array.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/array.cpp b/src/array.cpp index b382d3262..c1e47342c 100644 --- a/src/array.cpp +++ b/src/array.cpp @@ -10,12 +10,16 @@ struct Array { isize capacity; T &operator[](isize index) { - GB_ASSERT_MSG(0 <= index && index < count, "Index %td is out of bounds ranges 0..<%td", index, count); + #if !defined(NO_ARRAY_BOUNDS_CHECK) + GB_ASSERT_MSG(0 <= index && index < count, "Index %td is out of bounds ranges 0..<%td", index, count); + #endif return data[index]; } T const &operator[](isize index) const { - GB_ASSERT_MSG(0 <= index && index < count, "Index %td is out of bounds ranges 0..<%td", index, count); + #if !defined(NO_ARRAY_BOUNDS_CHECK) + GB_ASSERT_MSG(0 <= index && index < count, "Index %td is out of bounds ranges 0..<%td", index, count); + #endif return data[index]; } }; |