The behavior of std::advance is undefined if the specified sequence of increments would require that a non-incrementable iterator (such as the past-the-end iterator) is incremented.
This may happen when n > 1.
Also when n is greater than 1 the arithmetic mean is wrong (considering all the elements of the dataset instead of the correct subset).
The behavior of
std::advance
is undefined if the specified sequence of increments would require that a non-incrementable iterator (such as the past-the-end iterator) is incremented.This may happen when
n > 1
.Also when
n
is greater than1
the arithmetic mean is wrong (considering all the elements of the dataset instead of the correct subset).