public interface IRBNode : IComparable { IRBNode Left { get; set; } IRBNode Right { get; set; } Color Color { get; set; } IRBNode Parent { get; set; } IRBNode Grandparent(); IRBNode Sibling(); // { //#if ASSERT // Debug.Assert(Parent != null); // Root node has no sibling //#endif // if (this == Parent.Left) // return Parent.Right; // else // return Parent.Left; // } IRBNode Uncle(); // { //#if ASSERT // Debug.Assert(Parent != null); // Root node has no uncle // Debug.Assert(Parent.Parent != null); // Children of root have no uncle //#endif // return Parent.Sibling(); // } // } void AssignValueTo(IRBNode other); }转化为c
时间: 2024-02-10 22:35:25 浏览: 177
Interface_IComparable:Csharp可比接口的实现
# C# 接口定义
public interface IRBNode : IComparable
{
IRBNode Left { get; set; }
IRBNode Right { get; set; }
Color Color { get; set; }
IRBNode Parent { get; set; }
IRBNode Grandparent();
IRBNode Sibling();
IRBNode Uncle();
void AssignValueTo(IRBNode other);
}
# 转化为 C 语言结构体定义
typedef struct IRBNode {
struct IRBNode* Left;
struct IRBNode* Right;
Color Color;
struct IRBNode* Parent;
struct IRBNode* (*Grandparent)();
struct IRBNode* (*Sibling)();
struct IRBNode* (*Uncle)();
void (*AssignValueTo)(struct IRBNode* other);
} IRBNode;
阅读全文