Many posts compare the performance of these functions (std::copy, std::equal, std::fill), but I haven’t found what justifies the replacement by these new functions over the old one (std::memcpy, std::memcmp, std::memset) from a practical point of view. Of course, the list of functions is not exhaustive.
What are the practical advantages of these new versions ?
If performance is not a criterion for choosing, is it desirable (time permitting) to replace all occurrences of these C-style functions with the C++ versions ?
I tried to understand why some functions have been introduced in c++ and if it is necessary to do the replacement.
>Solution :
memset has two drastic limitations.
First the container. You can only memset more than a single element to a container that uses contiguous memory. It can work for std::array or std::vector but not for most other containers.
Next, the elements. You can only memset trivially copyable objects. Already something as "simple" as std::string is not trivially copyable.
memset can be used in some cases. The other functions you mention are more generally applicable and when they can be replaced by memset the compiler can do that.