mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 03:17:15 +02:00
protected cumulative_stats against count wraparound
This commit is contained in:
@ -77,8 +77,12 @@ public:
|
|||||||
static_assert(
|
static_assert(
|
||||||
sizeof...(Ts)==N,"A sample must be provided for each sequence.");
|
sizeof...(Ts)==N,"A sample must be provided for each sequence.");
|
||||||
|
|
||||||
|
if(BOOST_UNLIKELY(++n==0)){ /* wraparound */
|
||||||
|
reset();
|
||||||
|
n=1;
|
||||||
|
}
|
||||||
mp11::tuple_transform(
|
mp11::tuple_transform(
|
||||||
welfords_algorithm{++n},
|
welfords_algorithm{n},
|
||||||
std::forward_as_tuple(std::forward<Ts>(xs)...),
|
std::forward_as_tuple(std::forward<Ts>(xs)...),
|
||||||
data);
|
data);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user