Cppreference has this example code for std::transform:
std::vector ordinals;
std::transform(s.begin(), s.end(), std::back_inserter(ordinals),
I believe the transformation is guaranteed to be processed in-order. std::back_inserter_iterator
is an output iterator (its iterator_category
member type is an alias for std::output_iterator_tag
) according to [back.insert.iterator].
Consequently, std::transform
has no other option on how to proceed to next iteration than to call member operator++
on the result
parameter.
Of course, this is valid only for overloads without execution policy, where std::back_inserter_iterator
may not be used (it's not a forwarding iterator).
BTW, I wouldn't argument with quotes from cppreference. The statements there are often imprecise or simplified. In cases as these, it's better to look at the C++ Standard. Where, regarding to std::transform
, there is no quote about order of operations.