replace_elements function

Replacing elements in a vector