In the book “A Tour of C++” (third edition for c++20
) from Bjarne Stroustrup, section 18.5.2 packaged task, we have this piece of code :
// compute the sum of [beg:end) starting with the initial value init
double accum(vector<double>::iterator beg, vector<double>::iterator end, double init)
{
return accumulate(&*beg, &*end, init);
}
I wonder why B.Stroustrup use &* of the iterator instead of the iterator itself here, is it a mistake ?
8