Uhm, well. How often does one have a sum of N different argument
expressions, which all have side effects so that they must be evaluated
in order?
For a reasonable number of such arguments, say f1(), f2() and f3() all
with side-effects, which is a case that for me has occurred less than 1
time in 35 years, I'd just do
int sum = 0;
for( int x : {f1(), f2(), f3()} ) { sum += x; }
But then, I prefer to not use STL algorithms where similar size directly
expressed code can do it. Because with the directly expressed code one
doesn't have to know or look up details about the STL algorithm in
question. And I tend to forget such details.
Cheers!,
- Alf