MCPcopy Create free account
hub / github.com/davisking/dlib / fix_stack

Method fix_stack

dlib/binary_search_tree/binary_search_tree_kernel_1.h:1485–1521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1483 typename compare
1484 >
1485 bool binary_search_tree_kernel_1<domain,range,mem_manager,compare>::
1486 fix_stack (
1487 node* t,
1488 unsigned char depth
1489 )
1490 {
1491 // if we found the node we were looking for
1492 if (t == current_element)
1493 {
1494 stack_pos = depth;
1495 return true;
1496 }
1497 else if (t == 0)
1498 {
1499 return false;
1500 }
1501
1502 if (!( comp(t->d , current_element->d)))
1503 {
1504 // go left
1505 if (fix_stack(t->left,depth+1))
1506 {
1507 stack[depth] = t;
1508 return true;
1509 }
1510 }
1511 if (!(comp(current_element->d , t->d)))
1512 {
1513 // go right
1514 if (fix_stack(t->right,depth+1))
1515 {
1516 stack[depth] = t;
1517 return true;
1518 }
1519 }
1520 return false;
1521 }
1522
1523// ----------------------------------------------------------------------------------------
1524

Callers

nothing calls this directly

Calls 1

compFunction · 0.85

Tested by

no test coverage detected