The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Sumant Tambe (17) [Avatar] Offline
#1
Chapter 2, section 2.2.2: It may be worthwhile to discuss the guarantees of std::accumulate makes regarding making copies of the intermediate result in to the user-supplied function. I checked that std::accumulate requires that init value type be copy-assignable and copy-constructible. However, it looks like std::accumulate can be used to avoid copies either by returning a reference or by using std::ref and std::reference_wrapper.

I’ve not looked at moving_accumulate at the time of this writing.