Schnek
algohelper.hpp
1
/*
2
* algohelper.hpp
3
*
4
* Created on: 3 Oct 2012
5
* Author: Holger Schmitz
6
* Email: holger@notjustphysics.com
7
*
8
* Copyright 2012 Holger Schmitz
9
*
10
* This file is part of Schnek.
11
*
12
* Schnek is free software: you can redistribute it and/or modify
13
* it under the terms of the GNU General Public License as published by
14
* the Free Software Foundation, either version 3 of the License, or
15
* (at your option) any later version.
16
*
17
* Schnek is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
21
*
22
* You should have received a copy of the GNU General Public License
23
* along with Schnek. If not, see <http://www.gnu.org/licenses/>.
24
*
25
*/
26
27
#ifndef SCHNEK_ALGOHELPER_HPP
28
#define SCHNEK_ALGOHELPER_HPP
29
30
namespace
schnek
{
31
32
template
<
typename
T>
33
class
calcsum
34
{
35
private
:
36
T sum;
37
public
:
38
calcsum
() : sum(0) {}
39
calcsum
(
const
calcsum
&csum) : sum(csum.sum) {}
40
41
void
operator()(
const
T& x) { sum += x; }
42
T result() {
return
sum; }
43
};
44
45
}
// namespace schnek
46
47
#endif // SCHNEK_ALGOHELPER_HPP
schnek
Definition:
algo.hpp:30
schnek::calcsum
Definition:
algohelper.hpp:33
src
util
algohelper.hpp
Generated by
1.8.13