MCPcopy Create free account
hub / github.com/boostorg/histogram / sum

Function sum

examples/guide_histogram_reduction.cpp:10–15  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8// example of a generic function for histograms, this one sums all entries
9template <typename... Ts>
10typename bh::histogram<Ts...>::element_type sum(
11 const bh::histogram<Ts...>& h) {
12 auto result = typename bh::histogram<Ts...>::element_type(0);
13 for (auto x : h) result += x;
14 return result;
15}
16
17int main() {
18 using namespace bh::literals; // enables _c suffix

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected