Update CS:GO team score gamedata.
1 #ifndef _INCLUDE_KNIGHT_KE_VECTOR_H_
2 #define _INCLUDE_KNIGHT_KE_VECTOR_H_
12 KeVector<T>() : m_Data(NULL), m_Size(0), m_CurrentUsedSize(0)
16 KeVector<T>(const KeVector<T> & other)
18 m_Size = other.m_CurrentUsedSize;
19 m_CurrentUsedSize = other.m_CurrentUsedSize;
23 m_Data = new T[other.m_CurrentUsedSize];
25 for (size_t i = 0; i < m_Size; i++)
27 m_Data[i] = other.m_Data[i];
41 KeVector & operator =(const KeVector<T> & other)
45 if (other.m_CurrentUsedSize)
47 m_Data = new T[other.m_CurrentUsedSize];
48 m_Size = other.m_CurrentUsedSize;
49 m_CurrentUsedSize = other.m_CurrentUsedSize;
51 for (size_t i = 0; i < m_Size; i++)
53 m_Data[i] = other.m_Data[i];
60 return m_CurrentUsedSize;
63 void push_back(const T & elem)
67 new (&m_Data[m_CurrentUsedSize]) T(elem);
72 void pop_back(const T & elem)
74 if (m_CurrentUsedSize == 0)
80 m_Data[m_CurrentUsedSize].~T();
85 return (m_CurrentUsedSize == 0);
88 T & operator [](size_t pos)
93 const T & operator [](size_t pos) const
100 for (size_t i = 0; i < m_CurrentUsedSize; i++)
109 m_CurrentUsedSize = 0;
112 void Grow(size_t amount)
123 new_size = m_Size * 2;
126 while (m_CurrentUsedSize + amount > new_size)
131 new_data = (T *)malloc(sizeof(T) * new_size);
133 for (size_t i = 0; i < m_CurrentUsedSize; i++)
135 new (&new_data[i]) T(m_Data[i]);
144 void GrowIfNeeded(size_t amount)
146 if (m_CurrentUsedSize + amount >= m_Size)
154 size_t m_CurrentUsedSize;
158 #endif //_INCLUDE_KNIGHT_KE_VECTOR_H_