I’ve created function replaceElement. I’m not sure if old parameter should be first or second. What is common way for parameter order in this case?
void replaceElement(Element *old, Element *n);
or
void replaceElement(Element *n, Element *old);
I would choose
void replaceElement(Element *old, Element *n);It sounds better for me, and also you might want to make a default parameter later. And the default in your case will be
new.Also that’s how
std::replaceis formed: