Daily bit(e) of C++ | std::replace_copy, std::replace_copy_if
Daily bit(e) of C++ #419, Algorithms for copying a range while replacing some elements: std::replace_copy, std::replace_copy_if.
When we need to copy the content of a range, replacing some of the elements as we copy, we can use the std::replace_copy and std::replace_copy_if algorithms.
Both algorithms support projections in their range versions.