src/Containers.h

changeset 105
6dbac3305614
parent 94
8915ee6a277d
child 115
9be16e1c1e44
equal deleted inserted replaced
104:62da929f7814 105:6dbac3305614
142 return m_data[m_data.size() - 1]; 142 return m_data[m_data.size() - 1];
143 } 143 }
144 144
145 // ===================================================================== 145 // =====================================================================
146 // 146 //
147 void Merge (const SelfType& vals) 147 void Merge (const SelfType& other)
148 { 148 {
149 for (const T & val : vals) 149 m_data.resize (Size() + other.Size());
150 Append (val); 150 std::copy (other.begin(), other.end(), begin() + other.Size());
151 } 151 }
152 152
153 // ===================================================================== 153 // =====================================================================
154 // 154 //
155 bool Pop (T& val) 155 bool Pop (T& val)
329 // ===================================================================== 329 // =====================================================================
330 // 330 //
331 inline bool Contains (const ValueType& a) const 331 inline bool Contains (const ValueType& a) const
332 { 332 {
333 return Find (a) != -1; 333 return Find (a) != -1;
334 }
335
336 // =====================================================================
337 //
338 SelfType operator+ (const SelfType& other) const
339 {
340 SelfType out (*this);
341 out.Merge (other);
342 return out;
334 } 343 }
335 344
336 private: 345 private:
337 ListType m_data; 346 ListType m_data;
338 }; 347 };

mercurial