Question

Some of the algorithms of the standard library have a _copy version and some have not. Is there any objective criterion behind this ? (for example why there is a std::rotate_copy but no std::shuffle_copy ?)

Was it helpful?

Solution

It looks to me like the functions that have a _copy version are those where the work of the function could be combined with the work of copying, such that the operation could be done in one pass versus two.

This would not be the case for shuffle for example. There's nothing to be gained against doing a separate copy and shuffle as two operations.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top