Now using new assert in Vector.

This commit is contained in:
David Williams 2012-12-26 15:02:03 +00:00
parent e17271a2c7
commit a3cb8f7a76
3 changed files with 6 additions and 4 deletions

View File

@ -21,6 +21,8 @@ freely, subject to the following restrictions:
distribution.
*******************************************************************************/
#include <cassert>
namespace PolyVox
{
template <typename VertexType>

View File

@ -24,11 +24,11 @@ freely, subject to the following restrictions:
#ifndef __PolyVox_Vector_H__
#define __PolyVox_Vector_H__
#include "Impl/ErrorHandling.h"
#include "Impl/TypeDef.h"
#include "PolyVoxForwardDeclarations.h"
#include <cassert>
#include <cmath>
#include <cstring>
#include <iostream>

View File

@ -414,7 +414,7 @@ namespace PolyVox
template <uint32_t Size, typename StorageType, typename OperationType>
inline StorageType Vector<Size, StorageType, OperationType>::getElement(uint32_t index) const
{
assert(index < Size);
POLYVOX_ASSERT(index < Size, "Attempted to access invalid vector element.");
return m_tElements[index];
}
@ -465,7 +465,7 @@ namespace PolyVox
template <uint32_t Size, typename StorageType, typename OperationType>
inline void Vector<Size, StorageType, OperationType>::setElement(uint32_t index, StorageType tValue)
{
assert(index < Size);
POLYVOX_ASSERT(index < Size, "Attempted to access invalid vector element.");
m_tElements[index] = tValue;
}
@ -649,7 +649,7 @@ namespace PolyVox
{
// Standard float rules apply for divide-by-zero
m_tElements[ct] /= fLength;
assert(m_tElements[ct] == m_tElements[ct]); //Will assert if NAN
POLYVOX_ASSERT(m_tElements[ct] == m_tElements[ct], "Obtained NAN during vector normalisation. Perhaps the input vector was too short?");
}
}
}//namespace PolyVox