Ponca  84886bac0b52a686e88046a375da13f12f2b87d2
Point Cloud Analysis library
Loading...
Searching...
No Matches
kdTreeNearestIterator.h
1/*
2 This Source Code Form is subject to the terms of the Mozilla Public
3 License, v. 2.0. If a copy of the MPL was not distributed with this
4 file, You can obtain one at http://mozilla.org/MPL/2.0/.
5*/
6
7#pragma once
8
9#include <iterator>
10#include <cstddef>
11
12namespace Ponca {
13
25template<typename Index>
27{
28public:
29 using iterator_category = PONCA_MULTIARCH_CU_STD_NAMESPACE(input_iterator_tag);
30 using difference_type = std::ptrdiff_t;
31 using value_type = Index;
32 using pointer = Index*;
33 using reference = const Index&;
34
35 inline KdTreeNearestIterator() = default;
36 inline KdTreeNearestIterator(Index index) : m_index(index) {}
37 virtual inline ~KdTreeNearestIterator() = default;
38
39public:
41 inline bool operator !=(const KdTreeNearestIterator& other) const {
42 return m_index != other.m_index;
43 }
44
46 inline bool operator ==(const KdTreeNearestIterator& other) const {
47 return m_index == other.m_index;
48 }
49
52 ++m_index;
53 return *this;
54 }
55
58 KdTreeNearestIterator tmp = *this;
59 ++m_index;
60 return tmp;
61 }
62
64 inline void operator +=(int i) {m_index += i;}
65
67 inline reference operator *() const {
68 return const_cast<reference>(m_index);
69 }
70
71protected:
72 Index m_index {-1};
73};
74
75} // namespace ponca
Input iterator to read the KdTreeKNearestQueryBase object.
reference operator*() const
Dereference operator.
KdTreeNearestIterator & operator++()
Prefix increment.
bool operator==(const KdTreeNearestIterator &other) const
Equality operand.
bool operator!=(const KdTreeNearestIterator &other) const
Inequality operand.
void operator+=(int i)
Value increment.
KdTreeNearestIterator operator++(int)
Postfix increment.
This Source Code Form is subject to the terms of the Mozilla Public License, v.