Untitled

 avatar
unknown
plain_text
3 years ago
388 B
5
Indexable
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;
    }
}
Editor is loading...