Add assertions for out-of-bounds indices.
This commit is contained in:
parent
105020b5c1
commit
78734f6ad3
1 changed files with 3 additions and 2 deletions
|
@ -24,6 +24,7 @@
|
|||
#include <ciso646>
|
||||
#include <type_traits>
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
#include <iostream>
|
||||
|
@ -65,8 +66,8 @@ namespace cloonel {
|
|||
template <typename U> const Vector& operator*= ( U parOther );
|
||||
template <typename U> const Vector& operator/= ( U parOther );
|
||||
|
||||
T& operator[] ( uint32_t parIndex ) { return m_mem[parIndex]; }
|
||||
const T& operator[] ( uint32_t parIndex ) const { return m_mem[parIndex]; }
|
||||
T& operator[] ( uint32_t parIndex ) { assert(parIndex < S); return m_mem[parIndex]; }
|
||||
const T& operator[] ( uint32_t parIndex ) const { assert(parIndex < S); return m_mem[parIndex]; }
|
||||
|
||||
private:
|
||||
T m_mem[S];
|
||||
|
|
Loading…
Reference in a new issue