[generator] Fixed KDTree::_M_for_any

This commit is contained in:
Maksim Andrianov 2019-06-24 16:22:10 +03:00 committed by Tatiana Yan
parent 13c1ec8d82
commit 441cd8345a

View file

@ -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)
{