Logo Search packages:      
Sourcecode: ragel version File versions

template<class T, class Resize>
void SVector< T, Resize >::replace ( long  pos,
const T *  val,
long  len 
) [inline]

Replace len elements at position pos.

If there are existing elements at the positions to be replaced, then destructors are called before the space is used. Copy constructors are used to place the elements into the vector. It is allowable for the pos and length to specify a replacement that overwrites existing elements and creates new ones. If pos is greater than the length of the vector then undefined behaviour results. If pos is negative, then it is treated as an offset relative to the length of the vector.

Definition at line 358 of file svector.h.

References STable< T >::data.

{
      /* Common work for replacing in the vector. */
      pos = replaceCommon( pos, len );

      /* Copy data in using copy constructor. */
      T *dst = BaseTable::data + pos;
      const T *src = val;
      for ( long i = 0; i < len; i++, dst++, src++ )
            new(dst) T(*src);
}


Generated by  Doxygen 1.6.0   Back to index