Domanda

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 ?)

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top