\hypertarget{a00070}{
\section{mln::accu::math::sum$<$ T, S $>$ Struct Template Reference}
\label{d2/db1/a00070}\index{mln::accu::math::sum@{mln::accu::math::sum}}
}


Generic sum accumulator class.  




{\ttfamily \#include $<$sum.hh$>$}



Inherits base$<$ const S \&, sum$<$ T, S $>$ $>$.

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
bool \hyperlink{a00070_a2cdf28c2e1c5ffe26ecc25bd64c3d059}{is\_\-valid} () const 
\begin{DoxyCompactList}\small\item\em Check whether this accu is able to return a result. \item\end{DoxyCompactList}\item 
void \hyperlink{a00026_a745794a4ef16926d3c09ebbaa8b6b557}{take\_\-as\_\-init} (const T \&t)
\begin{DoxyCompactList}\small\item\em Take as initialization the value {\ttfamily t}. \item\end{DoxyCompactList}\item 
void \hyperlink{a00026_a138e094daa1a85f345bbdfd852c9fc67}{take\_\-n\_\-times} (unsigned n, const T \&t)
\begin{DoxyCompactList}\small\item\em Take {\ttfamily n} times the value {\ttfamily t}. \item\end{DoxyCompactList}\item 
const S \& \hyperlink{a00070_adb28930e787589b8b9967f5b65f130f2}{to\_\-result} () const 
\begin{DoxyCompactList}\small\item\em Get the value of the accumulator. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\begin{Indent}{\bf }\par
{\em \label{_amgrpd41d8cd98f00b204e9800998ecf8427e}
 }\begin{DoxyCompactItemize}
\item 
void \hyperlink{a00070_a906197152392a5e86760a892d012a30d}{init} ()
\begin{DoxyCompactList}\small\item\em Manipulators. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\end{Indent}


\subsection{Detailed Description}
\subsubsection*{template$<$typename T, typename S = typename mln::value::props$<$  T  $>$::sum$>$ struct mln::accu::math::sum$<$ T, S $>$}

Generic sum accumulator class. Parameter {\ttfamily T} is the type of values that we sum. Parameter {\ttfamily S} is the type to store the value sum; the default type of {\ttfamily S} is the summation type (property) of {\ttfamily T}. 

Definition at line 112 of file accu/math/sum.hh.



\subsection{Member Function Documentation}
\hypertarget{a00070_a906197152392a5e86760a892d012a30d}{
\index{mln::accu::math::sum@{mln::accu::math::sum}!init@{init}}
\index{init@{init}!mln::accu::math::sum@{mln::accu::math::sum}}
\subsubsection[{init}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T , typename S $>$ void {\bf mln::accu::math::sum}$<$ T, S $>$::init (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d2/db1/a00070_a906197152392a5e86760a892d012a30d}


Manipulators. 



Definition at line 161 of file accu/math/sum.hh.



References mln::literal::zero.

\hypertarget{a00070_a2cdf28c2e1c5ffe26ecc25bd64c3d059}{
\index{mln::accu::math::sum@{mln::accu::math::sum}!is\_\-valid@{is\_\-valid}}
\index{is\_\-valid@{is\_\-valid}!mln::accu::math::sum@{mln::accu::math::sum}}
\subsubsection[{is\_\-valid}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T , typename S $>$ bool {\bf mln::accu::math::sum}$<$ T, S $>$::is\_\-valid (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d2/db1/a00070_a2cdf28c2e1c5ffe26ecc25bd64c3d059}


Check whether this accu is able to return a result. 

Always true here. 

Definition at line 222 of file accu/math/sum.hh.

\hypertarget{a00026_a745794a4ef16926d3c09ebbaa8b6b557}{
\index{mln::accu::math::sum@{mln::accu::math::sum}!take\_\-as\_\-init@{take\_\-as\_\-init}}
\index{take\_\-as\_\-init@{take\_\-as\_\-init}!mln::accu::math::sum@{mln::accu::math::sum}}
\subsubsection[{take\_\-as\_\-init}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf mln::Accumulator}$<$ {\bf sum}$<$ T, S $>$  $>$::take\_\-as\_\-init (
\begin{DoxyParamCaption}
\item[{const T \&}]{ t}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inherited\mbox{]}}}}
\label{d6/d5b/a00026_a745794a4ef16926d3c09ebbaa8b6b557}


Take as initialization the value {\ttfamily t}. 

Dev note: this is a final method; override if needed by take\_\-as\_\-init\_\- (ending with '\_\-'). \hypertarget{a00026_a138e094daa1a85f345bbdfd852c9fc67}{
\index{mln::accu::math::sum@{mln::accu::math::sum}!take\_\-n\_\-times@{take\_\-n\_\-times}}
\index{take\_\-n\_\-times@{take\_\-n\_\-times}!mln::accu::math::sum@{mln::accu::math::sum}}
\subsubsection[{take\_\-n\_\-times}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf mln::Accumulator}$<$ {\bf sum}$<$ T, S $>$  $>$::take\_\-n\_\-times (
\begin{DoxyParamCaption}
\item[{unsigned}]{ n, }
\item[{const T \&}]{ t}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inherited\mbox{]}}}}
\label{d6/d5b/a00026_a138e094daa1a85f345bbdfd852c9fc67}


Take {\ttfamily n} times the value {\ttfamily t}. 

Dev note: this is a final method; override if needed by take\_\-as\_\-init\_\- (ending with '\_\-'). \hypertarget{a00070_adb28930e787589b8b9967f5b65f130f2}{
\index{mln::accu::math::sum@{mln::accu::math::sum}!to\_\-result@{to\_\-result}}
\index{to\_\-result@{to\_\-result}!mln::accu::math::sum@{mln::accu::math::sum}}
\subsubsection[{to\_\-result}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T , typename S $>$ const S \& {\bf mln::accu::math::sum}$<$ T, S $>$::to\_\-result (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d2/db1/a00070_adb28930e787589b8b9967f5b65f130f2}


Get the value of the accumulator. 



Definition at line 206 of file accu/math/sum.hh.

