I try to find any difference between copy(copy_if) and remove_copy(remove_copy_if) stl algorithms but it seems that there are no any practical differences instead of that:
Source and destination ranges cannot overlap in remove_copy algorithm
Is there really any significant and practical difference in these algorithms?
copy_if only copies elements satisfying a given predicate, remove_copy_if on the other hand copies only elements that do not satisfy a specified predicate. Thus the two functions complement each other, they do not do the same.
By the way for copy_if there is also similar statement The behavior is undefined if the source and the destination ranges overlap.
Thus it may not be checked but it is very bad idea to have the source and destination overlapping.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With