QMCPACK
IteratorUtility.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
8 // Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
9 //
10 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
11 //////////////////////////////////////////////////////////////////////////////////////
12 
13 
14 #ifndef OHMMS_ITERATOR_UTILITIES_H
15 #define OHMMS_ITERATOR_UTILITIES_H
16 
17 namespace qmcplusplus
18 {
19 /** delete the pointers in [first,last)
20 */
21 template<class IT>
22 inline void delete_iter(IT first, IT last)
23 {
24  while (first != last)
25  {
26  if (*first)
27  delete *first;
28  ++first;
29  }
30 }
31 
32 
33 template<typename IT1, typename IT2>
34 inline void accumulate_elements(IT1 first, IT1 last, IT2 res)
35 {
36  while (first != last)
37  *res++ += *first++;
38 }
39 
40 // template<typename IT1, typename IT2, typename INT>
41 // inline void accumulate_elements(IT1 first, IT2 res, INT n)
42 // {
43 // for(;n>0; n--) *res++ += *first++;
44 // }
45 
46 } // namespace qmcplusplus
47 #endif
void delete_iter(IT first, IT last)
delete the pointers in [first,last)
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
void accumulate_elements(IT1 first, IT1 last, IT2 res)