Both can be used to apply a function to a range of elements.
On a high level:
std::for_eachignores the return value of the function, and guarantees order of execution.std::transformassigns the return value to the iterator, and does not guarantee the order of execution.
When do you prefer using the one versus the other? Are there any subtle caveats?
Aucun commentaire:
Enregistrer un commentaire