BinaryTreesTryJoin
for BalancedTrees
This commit is contained in:
parent
7ec5f413c6
commit
0aa8080461
@ -136,3 +136,19 @@ impl<'a, BT: BinaryTreesUnbalanced<'a>> BinaryTreesHeight<'a> for BalancedTrees<
|
|||||||
self.0.leaf_height_error(height)
|
self.0.leaf_height_error(height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a, BT: BinaryTreesUnbalanced<'a> + BinaryTreesTryJoin<'a>> BinaryTreesTryJoin<'a>
|
||||||
|
for BalancedTrees<BT>
|
||||||
|
{
|
||||||
|
fn try_join(
|
||||||
|
&self,
|
||||||
|
tl: Self::Tree,
|
||||||
|
key: Self::Key,
|
||||||
|
tr: Self::Tree,
|
||||||
|
) -> BTWrap<'a, Self, Self::Node> {
|
||||||
|
let (hl, hr) = (self.0.height(&tl), self.0.height(&tr));
|
||||||
|
let ctx = self.0.clone();
|
||||||
|
self.0
|
||||||
|
.balancing_bind(balanced(hl, hr), |_| ctx.try_join(tl, key, tr))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user