forked from organicmaps/organicmaps
[generator] Fixed KDTree::_M_for_any
This commit is contained in:
parent
13c1ec8d82
commit
441cd8345a
1 changed files with 14 additions and 9 deletions
|
@ -402,9 +402,11 @@ namespace KDTree
|
|||
|
||||
template <class ToDo> bool for_any(ToDo toDo) const
|
||||
{
|
||||
bool wasСalled = false;
|
||||
if (_M_get_root())
|
||||
return _M_for_any(_M_get_root(), 0, toDo);
|
||||
return false;
|
||||
_M_for_any(_M_get_root(), 0, toDo, wasСalled);
|
||||
|
||||
return wasСalled;
|
||||
}
|
||||
|
||||
// compares via equality
|
||||
|
@ -666,21 +668,24 @@ namespace KDTree
|
|||
}
|
||||
|
||||
template <class ToDo>
|
||||
bool _M_for_any(_Link_const_type N, size_type const L, ToDo toDo) const
|
||||
void _M_for_any(_Link_const_type N, size_type const L, ToDo toDo, bool & wasСalled) const
|
||||
{
|
||||
if (wasСalled)
|
||||
return;
|
||||
|
||||
if (toDo.DoIfIntersects(_S_value(N)))
|
||||
return true;
|
||||
{
|
||||
wasСalled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_S_left(N) && toDo.ScanLeft(L, _S_value(N)))
|
||||
return _M_for_any(_S_left(N), L+1, toDo);
|
||||
_M_for_any(_S_left(N), L+1, toDo, wasСalled);
|
||||
|
||||
if (_S_right(N) && toDo.ScanRight(L, _S_value(N)))
|
||||
return _M_for_any(_S_right(N), L+1, toDo);
|
||||
|
||||
return false;
|
||||
_M_for_any(_S_right(N), L+1, toDo, wasСalled);
|
||||
}
|
||||
|
||||
|
||||
_Link_type
|
||||
_M_get_erase_replacement(_Link_type node, size_type const level)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue