Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Function template sum

boost::histogram::algorithm::sum — Compute the sum over all histogram cells, including underflow/overflow bins.

Synopsis

// In header: <boost/histogram/algorithm/sum.hpp>


template<typename A, typename S> auto sum(const histogram< A, S > & h);

Description

If the value type of the histogram is an integral or floating point type, boost::accumulators::sum<double> is used to compute the sum, else the original value type is used. Compilation fails, if the value type does not support operator+=.

Return type is double if the value type of the histogram is integral or floating point, and the original value type otherwise.


PrevUpHomeNext