簡體   English   中英

重置 Boost 參數化累加器

[英]Reset Boost parameterized Accumulator

如何重置使用參數創建的累加器? 換句話說,我想清除添加到累加器中的所有值。 這是使用參數創建的累加器的示例,

// https://www.boost.org/doc/libs/1_55_0/doc/html/accumulators/user_s_guide.html#accumulators.user_s_guide.the_statistical_accumulators_library.extended_p_square
using namespace boost::accumulators;

boost::array<double> probs = {0.001,0.01,0.1,0.25,0.5,0.75,0.9,0.99,0.999};
    accumulator_set<double, stats<tag::extended_p_square> >
acc(tag::extended_p_square::probabilities = probs); // <--- this const parameter

還有另一個問題/答案與使用acc = {}的問題/答案類似,但僅適用於未使用參數創建的累加器。 復位升壓蓄電池 c++

選項之一是創建包裝器 class 稍后在重置累加器時捕獲和重用累加器參數

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM