| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #ifndef ANKI_UTIL_ARRAY_H
- #define ANKI_UTIL_ARRAY_H
- #include "anki/util/Assert.h"
- #include "anki/util/StdTypes.h"
- namespace anki {
- /// @addtogroup util
- /// @{
- /// Array
- template<typename T, U N>
- struct Array
- {
- typedef T Value;
- typedef Value* Iterator;
- typedef const Value* ConstIterator;
- typedef Value& Reference;
- typedef const Value& ConstReference;
- Value data[N];
- Reference operator[](U n)
- {
- ANKI_ASSERT(n < N);
- return data[n];
- }
- ConstReference operator[](U n) const
- {
- ANKI_ASSERT(n < N);
- return data[n];
- }
- Iterator begin()
- {
- return &data[0];
- }
- ConstIterator begin() const
- {
- return &data[0];
- }
- Iterator end()
- {
- return &data[0] + N;
- }
- ConstIterator end() const
- {
- return &data[0] + N;
- }
- static constexpr U getSize()
- {
- return N;
- }
- };
- /// @}
- } // end namespace anki
- #endif
|