Page MenuHomeFreeBSD

D35518.id107143.diff
No OneTemporary

D35518.id107143.diff

Index: share/man/man3/tree.3
===================================================================
--- share/man/man3/tree.3
+++ share/man/man3/tree.3
@@ -98,7 +98,8 @@
.Nm RB_INIT ,
.Nm RB_INSERT ,
.Nm RB_REMOVE ,
-.Nm RB_REINSERT
+.Nm RB_REINSERT ,
+.Nm RB_AUGMENT
.Nd "implementations of splay and rank-balanced (wavl) trees"
.Sh SYNOPSIS
.In sys/tree.h
@@ -193,6 +194,8 @@
.Fn RB_REMOVE NAME "RB_HEAD *head" "struct TYPE *elm"
.Ft "struct TYPE *"
.Fn RB_REINSERT NAME "RB_HEAD *head" "struct TYPE *elm"
+.Ft "void"
+.Fn RB_AUGMENT NAME "struct TYPE *elm"
.Sh DESCRIPTION
These macros define data structures for different types of trees:
splay trees and rank-balanced (wavl) trees.
@@ -581,6 +584,20 @@
a node's key.
This is a lower overhead alternative to removing the element
and reinserting it again.
+.Pp
+The
+.Fn RB_AUGMENT
+macro updates augmentation data of the element
+.Fa elm
+in the tree.
+By default, it has no effect.
+It is not meant to be invoked by the RB user.
+If RB_AUGMENT is defined, then when an element is inserted or removed
+from the tree, it is invoked for every element in the tree that is the
+root of an altered subtree, working from the bottom of the tree up to
+the top.
+It is typically used to maintain some associative accumulation of tree
+elements, such as sums, minima, maxima, and the like.
.Sh EXAMPLES
The following example demonstrates how to declare a rank-balanced tree
holding integers.

File Metadata

Mime Type
text/plain
Expires
Sun, Aug 16, 3:21 PM (16 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36827016
Default Alt Text
D35518.id107143.diff (1 KB)

Event Timeline