Ponca  bab7704293a2c36e5bed9dea40def7ba839bfe08
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{
13
25 template <typename Index>
27 {
28 public:
29 using iterator_category = std::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 PONCA_MULTIARCH inline KdTreeNearestIterator() = default;
36 PONCA_MULTIARCH inline KdTreeNearestIterator(Index index) : m_index(index) {}
37 PONCA_MULTIARCH virtual inline ~KdTreeNearestIterator() = default;
38
39 public:
41 PONCA_MULTIARCH inline bool operator!=(const KdTreeNearestIterator& other) const
42 {
43 return m_index != other.m_index;
44 }
45
47 PONCA_MULTIARCH inline bool operator==(const KdTreeNearestIterator& other) const
48 {
49 return m_index == other.m_index;
50 }
51
53 PONCA_MULTIARCH inline KdTreeNearestIterator& operator++()
54 {
55 ++m_index;
56 return *this;
57 }
58
60 PONCA_MULTIARCH inline KdTreeNearestIterator operator++(int)
61 {
62 KdTreeNearestIterator tmp = *this;
63 ++m_index;
64 return tmp;
65 }
66
68 PONCA_MULTIARCH inline void operator+=(int i) { m_index += i; }
69
71 PONCA_MULTIARCH inline reference operator*() const { return const_cast<reference>(m_index); }
72
73 protected:
74 Index m_index{-1};
75 };
76
77} // 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.