Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
388 B
2
Indexable
Never
void Base :: rebase(Base * new_parent) {
 if(this -> head != nullptr && new_parent != nullptr) {
    for(int i = 0; i < this -> head -> children.size(); i++) {
        if (this -> head -> children[i] == this){
            this -> head ->children.erase(this ->head -> children.begin() + i);
        }
    }
    new_parent -> children.push_back(this);
    this -> head = new_parent;
    }
}