libxr 1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::RBTree< Key >::Node< Data > Class Template Reference

红黑树的泛型数据节点,继承自 BaseNode (Generic data node for Red-Black Tree, inheriting from BaseNode). More...

#include <rbt.hpp>

Inheritance diagram for LibXR::RBTree< Key >::Node< Data >:
Collaboration diagram for LibXR::RBTree< Key >::Node< Data >:

Public Member Functions

 Node ()
 默认构造函数,初始化数据为空 (Default constructor initializing an empty node).
 
 Node (const Data &data)
 使用指定数据构造节点 (Constructor initializing a node with the given data).
 
template<typename... Args>
 Node (Args... args)
 通过参数列表构造节点 (Constructor initializing a node using arguments list).
 
 operator Data & ()
 
Nodeoperator= (const Data &data)
 
Dataoperator-> ()
 
const Dataoperator-> () const
 
Dataoperator* ()
 

Data Fields

Data data_
 存储的数据 (Stored data).
 
- Data Fields inherited from LibXR::RBTree< Key >::BaseNode
Key key
 节点键值 (Key associated with the node).
 
RbtColor color
 节点颜色 (Color of the node).
 
BaseNodeleft = nullptr
 左子节点 (Left child node).
 
BaseNoderight = nullptr
 右子节点 (Right child node).
 
BaseNodeparent = nullptr
 父节点 (Parent node).
 
size_t size
 节点大小 (Size of the node).
 

Additional Inherited Members

- Protected Member Functions inherited from LibXR::RBTree< Key >::BaseNode
 BaseNode (size_t size)
 基本节点构造函数 (Constructor for BaseNode).
 

Detailed Description

template<typename Key>
template<typename Data>
class LibXR::RBTree< Key >::Node< Data >

红黑树的泛型数据节点,继承自 BaseNode (Generic data node for Red-Black Tree, inheriting from BaseNode).

Template Parameters
Data存储的数据类型 (Type of data stored in the node).

Definition at line 63 of file rbt.hpp.

Constructor & Destructor Documentation

◆ Node() [1/3]

template<typename Key >
template<typename Data >
LibXR::RBTree< Key >::Node< Data >::Node ( )
inline

默认构造函数,初始化数据为空 (Default constructor initializing an empty node).

Definition at line 70 of file rbt.hpp.

70: BaseNode(sizeof(Data)), data_{} {}
BaseNode(size_t size)
基本节点构造函数 (Constructor for BaseNode).
Definition rbt.hpp:53
Data data_
存储的数据 (Stored data).
Definition rbt.hpp:99
constexpr auto min(T1 a, T2 b) -> typename std::common_type< T1, T2 >::type
计算两个数的最小值

◆ Node() [2/3]

template<typename Key >
template<typename Data >
LibXR::RBTree< Key >::Node< Data >::Node ( const Data data)
inlineexplicit

使用指定数据构造节点 (Constructor initializing a node with the given data).

Parameters
data要存储的数据 (Data to store in the node).

Definition at line 77 of file rbt.hpp.

77: BaseNode(sizeof(Data)), data_(data) {}

◆ Node() [3/3]

template<typename Key >
template<typename Data >
template<typename... Args>
LibXR::RBTree< Key >::Node< Data >::Node ( Args...  args)
inlineexplicit

通过参数列表构造节点 (Constructor initializing a node using arguments list).

Template Parameters
Args参数类型 (Types of arguments for data initialization).
Parameters
args数据构造参数 (Arguments used for constructing the data).

Definition at line 85 of file rbt.hpp.

85 : BaseNode(sizeof(Data)), data_{args...}
86 {
87 }

Member Function Documentation

◆ operator Data &()

template<typename Key >
template<typename Data >
LibXR::RBTree< Key >::Node< Data >::operator Data & ( )
inline

Definition at line 89 of file rbt.hpp.

89{ return data_; }

◆ operator*()

template<typename Key >
template<typename Data >
Data & LibXR::RBTree< Key >::Node< Data >::operator* ( )
inline

Definition at line 97 of file rbt.hpp.

97{ return data_; }

◆ operator->() [1/2]

template<typename Key >
template<typename Data >
Data * LibXR::RBTree< Key >::Node< Data >::operator-> ( )
inline

Definition at line 95 of file rbt.hpp.

95{ return &data_; }

◆ operator->() [2/2]

template<typename Key >
template<typename Data >
const Data * LibXR::RBTree< Key >::Node< Data >::operator-> ( ) const
inline

Definition at line 96 of file rbt.hpp.

96{ return &data_; }

◆ operator=()

template<typename Key >
template<typename Data >
Node & LibXR::RBTree< Key >::Node< Data >::operator= ( const Data data)
inline

Definition at line 90 of file rbt.hpp.

91 {
92 data_ = data;
93 return *this;
94 }

Field Documentation

◆ data_

template<typename Key >
template<typename Data >
Data LibXR::RBTree< Key >::Node< Data >::data_

存储的数据 (Stored data).

Definition at line 99 of file rbt.hpp.


The documentation for this class was generated from the following file: