namespace dk { template TileIterator::TileIterator (qualif_vector_type* parData, const PixelConv& parPixConv, const coords& parArea) : m_tile_range(parArea), m_data(parData), m_pixel_conv(parPixConv) { DK_ASSERT(parData); DK_ASSERT(&m_pixel_conv != nullptr); } template TileIterator::TileIterator (qualif_vector_type* parData, const PixelConv& parPixConv, const coords& parStart, const coords& parArea) : m_tile_range(parStart, parArea), m_data(parData), m_pixel_conv(parPixConv) { DK_ASSERT(parData); DK_ASSERT(&m_pixel_conv != nullptr); } template void TileIterator::increment() { ++m_tile_range; } template void TileIterator::decrement() { --m_tile_range; } template void TileIterator::advance (size_t /*parAdvance*/) { //TODO: implement } template ptrdiff_t TileIterator::distance_to (const TileIterator& parOther) { return std::distance(to_index(m_tile_range), to_index(parOther.m_tile_range)); } template bool TileIterator::equal (const TileIterator& parOther) const { return m_data == parOther.m_data and m_tile_range.position() == parOther.m_tile_range.position(); } template T& TileIterator::dereference() const { const auto index = to_index(m_tile_range); DK_ASSERT(m_data); DK_ASSERT(index >= 0); DK_ASSERT(static_cast::type>(index) < m_data->size()); return (*m_data)[index]; } template auto TileIterator::raw_coords() const -> const TileCoordsType& { return m_tile_range; } template auto TileIterator::position() const -> const coords& { return m_tile_range.position(); } template auto TileIterator::pixel_position() const -> coords { return m_pixel_conv.to_pixel(this->position()); } template inline Vector make_past_end_coords (const Vector& parTo) { Vector retval(0); //for (CoordinateDistType d = 0; d < D - 1; ++d) { //retval[d] = parFrom[d]; //} retval[D - 1] = parTo[D - 1] + 1; return retval; } } //namespace dk