C++ 使用空的boost::累加器
如何检查空增压::蓄能器acc与否 例如:C++ 使用空的boost::累加器,c++,boost,nan,boost-accumulators,C++,Boost,Nan,Boost Accumulators,如何检查空增压::蓄能器acc与否 例如: if (acc.isEmpty())//I don't know what function here return 0; else return boost::accumulators::mean(acc). 因为如果它是空的,我得到boost::累加器::mean(acc)的NaN。您可以使用累加器: 或者,您可以通过调用以下命令来检查它是否为nan: 在某些平台上,nan可能正在发送信号(我不确定标准是否规定了这一点) if (boost
if (acc.isEmpty())//I don't know what function here
return 0;
else
return boost::accumulators::mean(acc).
因为如果它是空的,我得到boost::累加器::mean(acc)的NaN。您可以使用累加器: 或者,您可以通过调用以下命令来检查它是否为
nan
:
在某些平台上,nan可能正在发送信号(我不确定标准是否规定了这一点)
if (boost::accumulators::count(acc) == 0)//I don't know what function here
return 0;
else
return boost::accumulators::mean(acc);
if(std::isnan(boost::accumulators::mean(acc))
return 0;
else
return boost::accumulators::mean(acc);