STIR  6.2.0
more_algorithms.h
Go to the documentation of this file.
1 //
2 //
3 /*
4  Copyright (C) 2005- 2005, Hammersmith Imanet Ltd
5  This file is part of STIR.
6 
7  SPDX-License-Identifier: Apache-2.0
8 
9  See STIR/LICENSE.txt for details
10 */
11 #ifndef __stir_more_algorithms_H__
12 #define __stir_more_algorithms_H__
13 
22 #include "stir/common.h"
23 #include <iterator>
24 
25 START_NAMESPACE_STIR
26 
32 template <class iterT>
33 inline iterT abs_max_element(iterT start, iterT end);
34 
44 template <class IterT, class elemT>
45 inline elemT sum(IterT start, IterT end, elemT init);
46 
62 template <class IterT>
63 inline typename std::iterator_traits<IterT>::value_type sum(IterT start, IterT end);
64 
71 template <class IterT>
72 inline typename std::iterator_traits<IterT>::value_type average(IterT start, IterT end);
73 
74 END_NAMESPACE_STIR
75 
76 #include "stir/more_algorithms.inl"
77 #endif
Implementation of some functions missing from std::algorithm.
iterT abs_max_element(iterT start, iterT end)
Like std::max_element, but comparing after taking absolute value.
Definition: more_algorithms.inl:28
std::iterator_traits< IterT >::value_type average(IterT start, IterT end)
Compute the average of a sequence using sum(start,end).
Definition: more_algorithms.inl:75
std::iterator_traits< IterT >::value_type sum(IterT start, IterT end)
Compute the sum of a sequence using operator+=().
Definition: more_algorithms.inl:62
basic configuration include file