CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Public Attributes
DynArray< T > Class Template Reference

#include <DynArray.h>

Public Types

using const_reference = T const &
 
using reference = T &
 
using size_type = unsigned int
 
using value_type = T
 

Public Member Functions

Tback ()
 
T const & back () const
 
Tbegin ()
 
T const * begin () const
 
 DynArray ()
 
 DynArray (unsigned char *storage)
 
 DynArray (unsigned char *storage, unsigned int isize)
 
 DynArray (unsigned char *storage, unsigned int isize, T const &it)
 
 DynArray (DynArray const &)=delete
 
 DynArray (DynArray &&other)
 
bool empty () const
 
Tend ()
 
T const * end () const
 
Tfront ()
 
T const & front () const
 
DynArrayoperator= (DynArray const &)=delete
 
DynArrayoperator= (DynArray &&other)
 
Toperator[] (unsigned int i)
 
T const & operator[] (unsigned int i) const
 
void pop_back ()
 
void push_back (T const &t)
 
void push_back (T &&t)
 
unsigned int size () const
 
 ~DynArray ()
 

Public Attributes

Ta =nullptr
 
unsigned int s =0
 

Detailed Description

template<typename T>
class DynArray< T >

Definition at line 5 of file DynArray.h.

Member Typedef Documentation

template<typename T>
using DynArray< T >::const_reference = T const&

Definition at line 13 of file DynArray.h.

template<typename T>
using DynArray< T >::reference = T&

Definition at line 12 of file DynArray.h.

template<typename T>
using DynArray< T >::size_type = unsigned int

Definition at line 10 of file DynArray.h.

template<typename T>
using DynArray< T >::value_type = T

Definition at line 11 of file DynArray.h.

Constructor & Destructor Documentation

template<typename T>
DynArray< T >::DynArray ( )
inline

Definition at line 15 of file DynArray.h.

15 {}
template<typename T>
DynArray< T >::DynArray ( unsigned char *  storage)
inlineexplicit

Definition at line 17 of file DynArray.h.

17 : a((T*)(storage)), s(0){}
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8
long double T
template<typename T>
DynArray< T >::DynArray ( unsigned char *  storage,
unsigned int  isize 
)
inline

Definition at line 19 of file DynArray.h.

References DynArray< T >::begin(), i, and DynArray< T >::s.

19  : a((T*)(storage)), s(isize){
20  for (auto i=0U; i<s; ++i) new((begin()+i)) T();
21  }
int i
Definition: DBlmapReader.cc:9
T * a
Definition: DynArray.h:7
T * begin()
Definition: DynArray.h:36
unsigned int s
Definition: DynArray.h:8
long double T
template<typename T>
DynArray< T >::DynArray ( unsigned char *  storage,
unsigned int  isize,
T const &  it 
)
inline

Definition at line 22 of file DynArray.h.

References DynArray< T >::begin(), i, and DynArray< T >::s.

22  : a((T*)(storage)), s(isize){
23  for (auto i=0U; i<s; ++i) new((begin()+i)) T(it);
24  }
int i
Definition: DBlmapReader.cc:9
T * a
Definition: DynArray.h:7
T * begin()
Definition: DynArray.h:36
unsigned int s
Definition: DynArray.h:8
long double T
template<typename T>
DynArray< T >::DynArray ( DynArray< T > const &  )
delete
template<typename T>
DynArray< T >::DynArray ( DynArray< T > &&  other)
inline

Definition at line 29 of file DynArray.h.

References DynArray< T >::a, and DynArray< T >::s.

29 { a=other.a; s=other.s; other.s=0; other.a=nullptr;}
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8
template<typename T>
DynArray< T >::~DynArray ( )
inline

Definition at line 33 of file DynArray.h.

References DynArray< T >::a, i, and DynArray< T >::s.

33 { for (auto i=0U; i<s; ++i) a[i].~T(); }
int i
Definition: DBlmapReader.cc:9
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8
long double T

Member Function Documentation

template<typename T>
T& DynArray< T >::back ( )
inline

Definition at line 39 of file DynArray.h.

References DynArray< T >::a, and DynArray< T >::s.

Referenced by DynArray< T >::pop_back().

39 { return a[s-1];}
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8
template<typename T>
T const& DynArray< T >::back ( ) const
inline

Definition at line 48 of file DynArray.h.

References DynArray< T >::a, and DynArray< T >::s.

48 { return a[s-1];}
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8
template<typename T>
T* DynArray< T >::begin ( void  )
inline

Definition at line 36 of file DynArray.h.

References DynArray< T >::a.

Referenced by DynArray< T >::DynArray(), and DynArray< T >::push_back().

36 { return a;}
T * a
Definition: DynArray.h:7
template<typename T>
T const* DynArray< T >::begin ( void  ) const
inline

Definition at line 42 of file DynArray.h.

References DynArray< T >::a.

42 { return a;}
T * a
Definition: DynArray.h:7
template<typename T>
bool DynArray< T >::empty ( ) const
inline

Definition at line 45 of file DynArray.h.

References DynArray< T >::s.

45 { return 0==s;}
unsigned int s
Definition: DynArray.h:8
template<typename T>
T* DynArray< T >::end ( void  )
inline

Definition at line 37 of file DynArray.h.

References DynArray< T >::a, and DynArray< T >::s.

37 { return a+s;}
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8
template<typename T>
T const* DynArray< T >::end ( void  ) const
inline

Definition at line 43 of file DynArray.h.

References DynArray< T >::a, and DynArray< T >::s.

43 { return a+s;}
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8
template<typename T>
T& DynArray< T >::front ( )
inline

Definition at line 38 of file DynArray.h.

References DynArray< T >::a.

38 { return a[0];}
T * a
Definition: DynArray.h:7
template<typename T>
T const& DynArray< T >::front ( ) const
inline

Definition at line 47 of file DynArray.h.

References DynArray< T >::a.

47 { return a[0];}
T * a
Definition: DynArray.h:7
template<typename T>
DynArray& DynArray< T >::operator= ( DynArray< T > const &  )
delete
template<typename T>
DynArray& DynArray< T >::operator= ( DynArray< T > &&  other)
inline

Definition at line 30 of file DynArray.h.

References DynArray< T >::a, and DynArray< T >::s.

30 { a=other.a; s=other.s; other.s=0; other.a=nullptr; return *this;}
T * a
Definition: DynArray.h:7
unsigned int s
Definition: DynArray.h:8
template<typename T>
T& DynArray< T >::operator[] ( unsigned int  i)
inline

Definition at line 35 of file DynArray.h.

References DynArray< T >::a, and i.

35 { return a[i];}
int i
Definition: DBlmapReader.cc:9
T * a
Definition: DynArray.h:7
template<typename T>
T const& DynArray< T >::operator[] ( unsigned int  i) const
inline

Definition at line 41 of file DynArray.h.

References DynArray< T >::a, and i.

41 { return a[i];}
int i
Definition: DBlmapReader.cc:9
T * a
Definition: DynArray.h:7
template<typename T>
void DynArray< T >::pop_back ( )
inline

Definition at line 50 of file DynArray.h.

References DynArray< T >::back(), and DynArray< T >::s.

50 {back().~T(); --s;}
T & back()
Definition: DynArray.h:39
unsigned int s
Definition: DynArray.h:8
template<typename T>
void DynArray< T >::push_back ( T const &  t)
inline

Definition at line 51 of file DynArray.h.

References DynArray< T >::begin(), and DynArray< T >::s.

51 {new((begin()+s)) T(t);++s;}
T * begin()
Definition: DynArray.h:36
unsigned int s
Definition: DynArray.h:8
long double T
template<typename T>
void DynArray< T >::push_back ( T &&  t)
inline

Definition at line 52 of file DynArray.h.

References DynArray< T >::begin(), DynArray< T >::s, and lumiQTWidget::t.

52 {new((begin()+s)) T(t);++s;}
T * begin()
Definition: DynArray.h:36
unsigned int s
Definition: DynArray.h:8
long double T
template<typename T>
unsigned int DynArray< T >::size ( void  ) const
inline

Definition at line 44 of file DynArray.h.

References DynArray< T >::s.

Referenced by StripCPEfromTrackAngle::localParameters().

44 { return s;}
unsigned int s
Definition: DynArray.h:8

Member Data Documentation

template<typename T>
T* DynArray< T >::a =nullptr
template<typename T>
unsigned int DynArray< T >::s =0