How to create a copy of an array of values and an array of pointers without std?

  c++, copy, copy-constructor, struct

I can’t figure out how to make a copy of this structure:

struct Node {
private:
    int *keys_;
    int min_degree_;
    Node **children_;
    int count_;
    bool is_leaf_;
    ...

Well, I understand about half of it:

Node(Node const &node) {
    min_degree_ = node.min_degree_;
    is_leaf_ = node.is_leaf_;
    count_ = node.count_;
    ...
}

And how to make a copy of the value array(int *keys_) and pointer array(Node **children_) without std is not clear. The original object has to be deleted, so the references can be copied, though I’m not sure.

Source: Windows Questions C++

LEAVE A COMMENT