[#BloombergLP-bslalg-RbTreeNode]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::RbTreeNode
:relfileprefix: ../../
:mrdocs:

This POD&hyphen;like `class` describes a node suitable for use in a red&hyphen;black binary search tree, holding the addresses of the parent, left&hyphen;child, and right&hyphen;child nodes (any of which may be 0), as well as a &quot;color&quot; (red or black)&period; This class is a &quot;POD&hyphen;like&quot; to facilitate efficient allocation and use in the context of a container implementation&period; In order to meet the essential requirements of a POD type, this `class` does not define a constructor or destructor&period; However its data members are private&period; Since this class will be aligned to a word boundary, a pointer type will be a multiple of 4&period; This class use this property to reduce its size by storing the color information in the least significant bit of the parent pointer&period; Note that this type does not contain any &quot;payload&quot; member data&colon; Clients creating a red&hyphen;black binary search tree must define an appropriate node type that incorporates `RbTreeNode` (generally via inheritance), and that holds the &quot;key&quot; value and any associated data&period;

== Synopsis

Declared in `&lt;bslalg&lowbar;rbtreenode&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class RbTreeNode;
----

== Enums

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslalg/RbTreeNode/Color-048.adoc[`Color`] 
| Enumeration of the two colors used by red&hyphen;black tree nodes&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslalg/RbTreeNode/color-049.adoc[`color`] 
| Return the color of this node&period;
| xref:BloombergLP/bslalg/RbTreeNode/isBlack.adoc[`isBlack`] 
| Return `true` if this node is black&period;
| xref:BloombergLP/bslalg/RbTreeNode/isRed.adoc[`isRed`] 
| Return `true` if this node is red&period;
| xref:BloombergLP/bslalg/RbTreeNode/leftChild-01.adoc[`leftChild`] 
| `leftChild` overloads
| xref:BloombergLP/bslalg/RbTreeNode/makeBlack.adoc[`makeBlack`] 
| Set the color of this node to black&period; Note that this operation is at least as fast as (and potentially faster than) `setColor`&period;
| xref:BloombergLP/bslalg/RbTreeNode/makeRed.adoc[`makeRed`] 
| Set the color of this node to red&period; Note that this operation is at least as fast as (and potentially faster than) `setColor`&period;
| xref:BloombergLP/bslalg/RbTreeNode/parent-0ce.adoc[`parent`] 
| `parent` overloads
| xref:BloombergLP/bslalg/RbTreeNode/reset.adoc[`reset`] 
| Reset this object to have the specified `parent`, `leftChild`, `rightChild`, and `color` property values&period;
| xref:BloombergLP/bslalg/RbTreeNode/rightChild-06.adoc[`rightChild`] 
| `rightChild` overloads
| xref:BloombergLP/bslalg/RbTreeNode/setColor.adoc[`setColor`] 
| Set the color of this node to the specified `value`&period;
| xref:BloombergLP/bslalg/RbTreeNode/setLeftChild.adoc[`setLeftChild`] 
| Set the left child of this node to the specified `address`&period; If `address` is 0, then this node will not have a left child&period;
| xref:BloombergLP/bslalg/RbTreeNode/setParent.adoc[`setParent`] 
| Set the parent of this node to the specified `address`&period; If `address` is 0, then this node will have not have a parent node (i&period;e&period;, it will be the root node)&period; The behavior is undefined unless `address` is aligned to at least two bytes&period;
| xref:BloombergLP/bslalg/RbTreeNode/setRightChild.adoc[`setRightChild`] 
| Set the right child of this node to the specified `address`&period; If `address` is 0, then this node will not have a right child&period;
| xref:BloombergLP/bslalg/RbTreeNode/toggleColor.adoc[`toggleColor`] 
| Set the color of this node to the alternative color&period; If this node&apos;s color is red, set it to black, and set it to red otherwise&period; Note that this operation is at least as fast as (and potentially faster than) `setColor`&period;
|===


== Derived Classes

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/TreeNode.adoc[`TreeNode`] 
| This POD&hyphen;like `class` describes a node suitable for use in a red&hyphen;black binary search tree of values of the parameterized `VALUE`&period; This class is a &quot;POD&hyphen;like&quot; to facilitate efficient allocation and use in the context of a container implementation&period; In order to meet the essential requirements of a POD type, this `class` does not define a constructor or destructor&period; The manipulator, `value`, returns a modifiable reference to `d&lowbar;value` so that it may be constructed in&hyphen;place by the appropriate `bsl&colon;&colon;allocator&lowbar;traits` object&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
