diff --git a/include/boost/unordered/detail/cumulative_stats.hpp b/include/boost/unordered/detail/cumulative_stats.hpp index 18f96d39..8be500c1 100644 --- a/include/boost/unordered/detail/cumulative_stats.hpp +++ b/include/boost/unordered/detail/cumulative_stats.hpp @@ -44,8 +44,12 @@ struct cumulative_stats_data struct welfords_algorithm /* 0-based */ { template - int operator()(T&& x,cumulative_stats_data& d)const + int operator()(T&& x,cumulative_stats_data& d)const noexcept { + static_assert( + noexcept(static_cast(x)), + "Argument conversion to double must not throw."); + d.m_prior=d.m; d.m+=(static_cast(x)-d.m)/static_cast(n); d.s+=(n!=1)* @@ -68,7 +72,7 @@ public: void reset()noexcept{*this=cumulative_stats();} template - void add(Ts&&... xs) + void add(Ts&&... xs)noexcept { static_assert( sizeof...(Ts)==N,"A sample must be provided for each sequence."); @@ -122,7 +126,7 @@ public: } template - void add(Ts&&... xs) + void add(Ts&&... xs)noexcept { lock_guard lck{mut}; super::add(std::forward(xs)...);