0

I was looking at the code of the boost Fibonacci heap, and in many places, I saw a variable called _id of type ID (part of the template) being used like this:get(_id, d), where d is of type T&, where T is part of the template. What is the purpose of this, and what would the equivalent of this be with only the default c++ standard libraries.

Here is the code for the fibonacci heap:

 void push(const T& d) {
        ++_n;
        size_type v = get(_id, d);
        _key[v] = d;
        _p[v] = nil();
        _degree[v] = 0;
        _mark[v] = false;
        _child[v] = nil();
        if (_root == nil()) {
            _root = _left[v] = _right[v] = v;
            //std::cout << "root added" << std::endl;
        } else {
            size_type u = _left[_root];
            _left[v] = u;
            _right[v] = _root;
            _left[_root] = _right[u] = v;
            if (_compare(d, _key[_root]))
                _root = v;
            //std::cout << "non-root node added" << std::endl;
        }
    }
user2472071
  • 767
  • 1
  • 6
  • 11

0 Answers0