10 #include <boost/intrusive/detail/parent_from_member.hpp>
11 #include <boost/iterator/iterator_facade.hpp>
13 #define IS_INT_NODE(node) (node->intnode_)
44 template <
class D, Node D::* P,
class K>
50 class Iterator :
public boost::iterator_facade<Iterator,
52 boost::forward_traversal_tag,
76 return Iterator(
this,
GetNext(NULL));
84 return Iterator(
this,
FindNext(data));
126 return static_cast<const Node *
>(&(data->*P));
134 return static_cast<Node *
>(&(data->*P));
142 return boost::intrusive::detail::parent_from_member<D, Node>(node, P);
150 return boost::intrusive::detail::parent_from_member<D, Node>(node, P);
313 }
else if (x->
left_) {
437 }
else if (
GetBit(node, i)) {
454 if (!x ||
GetBit(node, i)) {
542 Node * p, * x, *l, *r, *right_turn, *greatest_partial;
548 greatest_partial = NULL;
562 greatest_partial = x;
576 if (right_turn && greatest_partial) {
578 return greatest_partial;
583 return greatest_partial;
586 x = right_turn->
left_;
633 if (pos >= K::BitLength(data)) {
637 return K::ByteValue(data, pos >> 3) & (0x80 >> (pos & 7));
642 const D * data_right =
NodeToData(node_right);
643 if (K::BitLength(data_left) != K::BitLength(data_right)) {
647 std::size_t byteLen = K::BitLength(data_left) >> 3;
650 for (pos = 0; pos < byteLen; ++pos) {
651 if (K::ByteValue(data_left, pos) != K::ByteValue(data_right, pos)) {
656 for (pos <<= 3; pos < K::BitLength(data_left); ++pos) {
657 if (
GetBit(node_left, pos) !=
GetBit(node_right, pos)) {
665 bool Compare(
const Node *node_left,
const Node *node_right, std::size_t start, std::size_t& pos) {
667 const D * data_right =
NodeToData(node_right);
668 std::size_t shortLen;
672 if (K::BitLength(data_left) < K::BitLength(data_right)) {
673 shortLen = K::BitLength(data_left);
676 shortLen = K::BitLength(data_right);
677 isEqual = (K::BitLength(data_left) == K::BitLength(data_right));
680 std::size_t byteLen = shortLen >> 3;
682 for (pos = start >> 3; pos < byteLen; ++pos) {
683 if (K::ByteValue(data_left, pos) != K::ByteValue(data_right, pos)) {
693 for (; pos < shortLen; ++pos) {
694 if (
GetBit(node_left, pos) !=
GetBit(node_right, pos)) {
bool RemoveNode(Node *node)
D * GetPrev(const D *data)
bool InsertNode(Node *node)
Iterator LowerBound(D *data)
bool equal(const Iterator &it) const
#define IS_INT_NODE(node)
Node * RewireRightMost(Node *p, Node *x)
Node * FindNode(const Node *node)
D * NodeToData(Node *node)
Node * GetNextNode(Node *node)
Node * FindBestMatchNode(const Node *node)
friend class boost::iterator_core_access
D * LPMFind(const D *data)
bool GetBit(const Node *node, std::size_t pos)
Node * FindNextNode(const Node *node)
D * FindNext(const D *data)
bool Compare(const Node *node_left, const Node *node_right)
Node * GetPrevNode(const Node *node)
Node * DataToNode(D *data)
Iterator(Tree< D, P, K > *tree, D *data)
const Node * DataToNode(const D *data)
bool Compare(const Node *node_left, const Node *node_right, std::size_t start, std::size_t &pos)
const D * NodeToData(const Node *node)