3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Function template sum</title>
5 <link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../../../index.html" title="Chapter 1. Boost.Histogram">
8 <link rel="up" href="../../../histogram/reference.html#header.boost.histogram.algorithm.sum_hpp" title="Header <boost/histogram/algorithm/sum.hpp>">
9 <link rel="prev" href="../accumulators/sum.html" title="Class template sum">
10 <link rel="next" href="../accumulators/thread_safe.html" title="Class template thread_safe">
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../../libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
22 <div class="spirit-nav">
23 <a accesskey="p" href="../accumulators/sum.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../histogram/reference.html#header.boost.histogram.algorithm.sum_hpp"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../accumulators/thread_safe.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
25 <div class="refentry">
26 <a name="boost.histogram.algorithm.sum"></a><div class="titlepage"></div>
27 <div class="refnamediv">
28 <h2><span class="refentrytitle">Function template sum</span></h2>
29 <p>boost::histogram::algorithm::sum — Compute the sum over all histogram cells, including underflow/overflow bins. </p>
31 <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
32 <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../../histogram/reference.html#header.boost.histogram.algorithm.sum_hpp" title="Header <boost/histogram/algorithm/sum.hpp>">boost/histogram/algorithm/sum.hpp</a>>
35 <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> A<span class="special">,</span> <span class="keyword">typename</span> S<span class="special">></span> <span class="keyword">auto</span> <span class="identifier">sum</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="../histogram.html" title="Class template histogram">histogram</a><span class="special"><</span> <span class="identifier">A</span><span class="special">,</span> <span class="identifier">S</span> <span class="special">></span> <span class="special">&</span> h<span class="special">)</span><span class="special">;</span></pre></div>
36 <div class="refsect1">
37 <a name="idm45212148846944"></a><h2>Description</h2>
38 <p>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+=.</p>
39 <p>Return type is double if the value type of the histogram is integral or floating point, and the original value type otherwise. </p>
42 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
43 <td align="left"></td>
44 <td align="right"><div class="copyright-footer">Copyright © 2016-2019 Hans
46 Distributed under the Boost Software License, Version 1.0. (See accompanying
47 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
52 <div class="spirit-nav">
53 <a accesskey="p" href="../accumulators/sum.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../histogram/reference.html#header.boost.histogram.algorithm.sum_hpp"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../accumulators/thread_safe.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>