Bläddra i källkod

Make some AVL tree code less verbose.

legacy
Sam Hocevar 7 år sedan
förälder
incheckning
9981cf4ce9
1 ändrade filer med 2 tillägg och 2 borttagningar
  1. +2
    -2
      src/lol/base/avl_tree.h

+ 2
- 2
src/lol/base/avl_tree.h Visa fil

@@ -341,8 +341,8 @@ protected:

void update_balance()
{
m_stairs[0] = m_child[0] ? (m_child[0]->m_stairs[0] > m_child[0]->m_stairs[1] ? m_child[0]->m_stairs[0] : m_child[0]->m_stairs[1]) + 1 : 0;
m_stairs[1] = m_child[1] ? (m_child[1]->m_stairs[0] > m_child[1]->m_stairs[1] ? m_child[1]->m_stairs[0] : m_child[1]->m_stairs[1]) + 1 : 0;
for (int i = 0; i <= 1; ++i)
m_stairs[i] = m_child[i] ? std::max(m_child[i]->m_stairs[0], m_child[i]->m_stairs[1]) + 1 : 0;
}

void rebalance_if_needed()


Laddar…
Avbryt
Spara