Ponca  93eea5457c48839cb5d16642765afa89fc7cfe66
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 <cstddef>
10
11namespace Ponca {
12
24template<typename Index>
26{
27public:
28 using iterator_category = std::input_iterator_tag;
29 using difference_type = std::ptrdiff_t;
30 using value_type = Index;
31 using pointer = Index*;
32 using reference = const Index&;
33
34 PONCA_MULTIARCH inline KdTreeNearestIterator() = default;
35 PONCA_MULTIARCH inline KdTreeNearestIterator(Index index) : m_index(index) {}
36 PONCA_MULTIARCH virtual inline ~KdTreeNearestIterator() = default;
37
38public:
40 PONCA_MULTIARCH inline bool operator !=(const KdTreeNearestIterator& other) const {
41 return m_index != other.m_index;
42 }
43
45 PONCA_MULTIARCH inline bool operator ==(const KdTreeNearestIterator& other) const {
46 return m_index == other.m_index;
47 }
48
50 PONCA_MULTIARCH inline KdTreeNearestIterator& operator ++() {
51 ++m_index;
52 return *this;
53 }
54
56 PONCA_MULTIARCH inline KdTreeNearestIterator operator++(int) {
57 KdTreeNearestIterator tmp = *this;
58 ++m_index;
59 return tmp;
60 }
61
63 PONCA_MULTIARCH inline void operator +=(int i) {m_index += i;}
64
66 PONCA_MULTIARCH inline reference operator *() const {
67 return const_cast<reference>(m_index);
68 }
69
70protected:
71 Index m_index {-1};
72};
73
74} // 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.