Intrusive binary tree container example
#include <iostream>
{
int value;
MyBinTreeNode(int v) : value(v) {}
friend bool operator<(
const MyBinTreeNode& node1,
const MyBinTreeNode& node2)
{ return node1.value < node2.value; }
};
int main(int argc, char** argv)
{
assert("Duplicate node can not be inserted into the binary tree!");
MyBinTreeNode item1(1);
MyBinTreeNode item2(2);
MyBinTreeNode item3(3);
MyBinTreeNode item4(4);
MyBinTreeNode item5(5);
MyBinTreeNode item6(6);
MyBinTreeNode item7(7);
MyBinTreeNode item8(8);
MyBinTreeNode item9(9);
std::cout << "bintree:" << std::endl;
for (const auto& item : bintree)
std::cout << item.value << std::endl;
return 0;
}
Intrusive non balanced binary tree container definition.
Intrusive non balanced binary tree container.
std::pair< iterator, bool > insert(T &item) noexcept
Insert a new item into the binary tree.
bool operator<(const uint128_t &value1, const uint128_t &value2) noexcept