Crash fix when going from a smaller view to a larger one.
This commit is contained in:
parent
b2eae08d02
commit
edbb3fe1d8
4 changed files with 20 additions and 9 deletions
|
@ -9,6 +9,9 @@
|
|||
#include <vector>
|
||||
#include <memory>
|
||||
#include <cstdint>
|
||||
#if !defined(NDEBUG)
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
namespace dk {
|
||||
template <uint32_t D>
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace dk {
|
|||
void advance ( size_t parAdvance );
|
||||
ptrdiff_t distance_to ( const TileIterator& parOther );
|
||||
bool equal ( const TileIterator& parOther ) const;
|
||||
T& dereference ( void ) const { return (*m_data)[get_current_index()]; }
|
||||
T& dereference ( void ) const;
|
||||
size_t get_current_index ( void ) const { return implem::get_index_from_pos<D>(m_pos, m_subdivareasize) + m_subindex; }
|
||||
|
||||
coords m_pos;
|
||||
|
|
|
@ -139,4 +139,12 @@ namespace dk {
|
|||
bool TileIterator<T, D, T1>::equal (const TileIterator& parOther) const {
|
||||
return m_data == parOther.m_data and m_pos == parOther.m_pos;
|
||||
}
|
||||
|
||||
template <typename T, uint32_t D, typename T1>
|
||||
T& TileIterator<T, D, T1>::dereference() const {
|
||||
const auto index = this->get_current_index();
|
||||
assert(m_data);
|
||||
assert(index < m_data->size());
|
||||
return (*m_data)[index];
|
||||
}
|
||||
} //namespace dk
|
||||
|
|
|
@ -199,33 +199,33 @@ namespace cloonel {
|
|||
///--------------------------------------------------------------------------
|
||||
template <typename T, typename U, uint32_t S>
|
||||
inline bool operator< (const Vector<T, S>& parA, const Vector<U, S>& parB) {
|
||||
bool retVal = true;
|
||||
bool retVal = false;
|
||||
for (uint32_t z = 0; z < S; ++z) {
|
||||
retVal &= static_cast<bool>(parA[z] < parB[z]);
|
||||
retVal |= static_cast<bool>(parA[z] < parB[z]);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
template <typename T, typename U, uint32_t S>
|
||||
inline bool operator> (const Vector<T, S>& parA, const Vector<U, S>& parB) {
|
||||
bool retVal = true;
|
||||
bool retVal = false;
|
||||
for (uint32_t z = 0; z < S; ++z) {
|
||||
retVal &= static_cast<bool>(parA[z] > parB[z]);
|
||||
retVal |= static_cast<bool>(parA[z] > parB[z]);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
template <typename T, typename U, uint32_t S>
|
||||
inline bool operator<= (const Vector<T, S>& parA, const Vector<U, S>& parB) {
|
||||
bool retVal = true;
|
||||
bool retVal = false;
|
||||
for (uint32_t z = 0; z < S; ++z) {
|
||||
retVal &= static_cast<bool>(parA[z] <= parB[z]);
|
||||
retVal |= static_cast<bool>(parA[z] <= parB[z]);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
template <typename T, typename U, uint32_t S>
|
||||
inline bool operator>= (const Vector<T, S>& parA, const Vector<U, S>& parB) {
|
||||
bool retVal = true;
|
||||
bool retVal = false;
|
||||
for (uint32_t z = 0; z < S; ++z) {
|
||||
retVal &= static_cast<bool>(parA[z] >= parB[z]);
|
||||
retVal |= static_cast<bool>(parA[z] >= parB[z]);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue