BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/MdcPatRec/MdcRecoUtil/include/MdcRecoUtil/BesCollectionUtils.h
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3//
4// Description:
5//
6//
7//
8// Environment:
9// Software developed for the BaBar Detector at the SLAC B-Factory.
10//
11// Author List:
12// Matthias Steinke
13//
14//
15// Copyright Information:
16//
17//------------------------------------------------------------------------
18
19#ifndef BBRCOLLECTIONUTILS_HH
20#define BBRCOLLECTIONUTILS_HH
21
22#include <algorithm>
23
24// CHANGE namespace babar {
25namespace bes {
26 namespace Collection {
27
28#ifdef OO_DDL_TRANSLATION
29 struct PtrLess;
30#else
31 struct PtrLess {
32 template <class PtrType> bool operator()( PtrType ptr1, PtrType ptr2 ) const {
33 return ( *ptr1 ) < ( *ptr2 );
34 }
35 };
36#endif
37
38 struct DeleteObject {
39
40 // Sun does not like typename, have to use class
41 // template< typename T >
42 template <class T> void operator()( const T* ptr ) const { delete ptr; }
43 };
44
45 struct DeleteArray {
46
47 // Sun does not like typename, have to use class
48 // template< typename T >
49 template <class T> void operator()( const T array[] ) const { delete[] array; }
50 };
51
52 /**
53 * Determines the offset of the first occurrence of a specified
54 * value in a container. This is _not_ an STL-ish way to work;
55 * the use of std::find() and iterators instead of offsets is
56 * _strongly_ preferred, even for vectors.
57 *
58 * This function is supplied only as a migration aid for previous users
59 * of the Rogue Wave vector classes.
60 *
61 * It is valid for any container type C for whose iterators
62 * operator- is defined. When a restriction in the STL supplied
63 * by RW for Sun is removed in the future (see below),
64 * it could be rewritten to work for all containers.
65 */
66 template <class C, class T>
67 typename C::difference_type findIndex( const C& container, const T& value ) {
68 typename C::const_iterator found =
69 std::find( container.begin(), container.end(), value );
70
71 // Were std::distance available, one would write: FIXME
72 //// return std::distance( container.begin(), found );
73
74 // Meanwhile, this should only compile for iterators for which it is efficient:
75 return found - container.begin();
76 }
77
78 } // namespace Collection
79} // namespace bes
80
81#endif
***************************************************************************************Pseudo Class RRes *****************************************************************************************Parameters and physical constants **Maarten sept ************************************************************************DOUBLE PRECISION xsmu **************************************************************************PARTICLE DATA all others are from PDG *Only resonances with known widths into electron pairs are sept ************************************************************************C Declarations C
Definition RRes.h:29
C::difference_type findIndex(const C &container, const T &value)