From 9a3b4167bb8495f9422ffa5cb242198fed3a315b Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Thu, 20 Jul 2017 19:40:51 +0100 Subject: Fix polymorphic element types usage; Empty `union` as opaque type --- src/array.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/array.cpp') 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]; } }; -- cgit v1.2.3