@@ -240,76 +240,9 @@ class CDataStream
240
240
const_reference operator [](size_type pos) const { return vch[pos + nReadPos]; }
241
241
reference operator [](size_type pos) { return vch[pos + nReadPos]; }
242
242
void clear () { vch.clear (); nReadPos = 0 ; }
243
- iterator insert (iterator it, const value_type x) { return vch.insert (it, x); }
244
- void insert (iterator it, size_type n, const value_type x) { vch.insert (it, n, x); }
245
243
value_type* data () { return vch.data () + nReadPos; }
246
244
const value_type* data () const { return vch.data () + nReadPos; }
247
245
248
- void insert (iterator it, std::vector<value_type>::const_iterator first, std::vector<value_type>::const_iterator last)
249
- {
250
- if (last == first) return ;
251
- assert (last - first > 0 );
252
- if (it == vch.begin () + nReadPos && (unsigned int )(last - first) <= nReadPos)
253
- {
254
- // special case for inserting at the front when there's room
255
- nReadPos -= (last - first);
256
- memcpy (&vch[nReadPos], &first[0 ], last - first);
257
- }
258
- else
259
- vch.insert (it, first, last);
260
- }
261
-
262
- void insert (iterator it, const value_type* first, const value_type* last)
263
- {
264
- if (last == first) return ;
265
- assert (last - first > 0 );
266
- if (it == vch.begin () + nReadPos && (unsigned int )(last - first) <= nReadPos)
267
- {
268
- // special case for inserting at the front when there's room
269
- nReadPos -= (last - first);
270
- memcpy (&vch[nReadPos], &first[0 ], last - first);
271
- }
272
- else
273
- vch.insert (it, first, last);
274
- }
275
-
276
- iterator erase (iterator it)
277
- {
278
- if (it == vch.begin () + nReadPos)
279
- {
280
- // special case for erasing from the front
281
- if (++nReadPos >= vch.size ())
282
- {
283
- // whenever we reach the end, we take the opportunity to clear the buffer
284
- nReadPos = 0 ;
285
- return vch.erase (vch.begin (), vch.end ());
286
- }
287
- return vch.begin () + nReadPos;
288
- }
289
- else
290
- return vch.erase (it);
291
- }
292
-
293
- iterator erase (iterator first, iterator last)
294
- {
295
- if (first == vch.begin () + nReadPos)
296
- {
297
- // special case for erasing from the front
298
- if (last == vch.end ())
299
- {
300
- nReadPos = 0 ;
301
- return vch.erase (vch.begin (), vch.end ());
302
- }
303
- else
304
- {
305
- nReadPos = (last - vch.begin ());
306
- return last;
307
- }
308
- }
309
- else
310
- return vch.erase (first, last);
311
- }
312
-
313
246
inline void Compact ()
314
247
{
315
248
vch.erase (vch.begin (), vch.begin () + nReadPos);
0 commit comments