Slava
Slava

Reputation: 1523

partial_sum, destination range same as input. guaranteed to work?

Basically I want to replace the values in the vector by the corresponding partial_sum. And I can not find in the reference whether it is guaranteed to work in case the destination range is the same as input.

And what about inclusive_scan?

Upvotes: 2

Views: 78

Answers (1)

songyuanyao
songyuanyao

Reputation: 172984

It's guaranteed to work. The standard mentioned this, $26.8.6/5 Partial sum [partial.sum]

5 Remarks: result may be equal to first.

And it's same for inclusive_scan. $26.8.8/6 Inclusive scan [inclusive.scan]

6 Remarks: result may be equal to first.

Upvotes: 3

Related Questions