ATLAS Offline Software
findInContainer.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // $Id: findInContainer.h,v 1.3 2007-06-14 22:38:50 ssnyder Exp $
16 #ifndef ATHLINKS_FINDINCONTAINER_H
17 #define ATHLINKS_FINDINCONTAINER_H
18 
19 
20 namespace SG {
21 
22 
35 template <typename CONT, typename ELT>
36 bool
37 findInContainer(const CONT& data,
38  const ELT& element,
39  typename CONT::size_type& index)
40 {
41  typedef typename CONT::const_iterator const_iterator;
42  const_iterator end = data.end();
43  index = 0;
44  for (const_iterator it = data.begin(); it != end; ++it) {
45  if (*it == element) return true;
46  ++index;
47  }
48  return false;
49 }
50 
51 
52 } // namespace SG
53 
54 
55 #endif // ATHLINKS_FINDINCONTAINER_H
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
index
Definition: index.py:1
skel.it
it
Definition: skel.GENtoEVGEN.py:396
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
SG::findInContainer
bool findInContainer(const CaloCellContainer &data, CaloCell const *const &element, CaloCellContainer::size_type &index)
Definition: CaloCellContainer.cxx:676
DeMoScan.index
string index
Definition: DeMoScan.py:364