Logo Search packages:      
Sourcecode: ragel version File versions

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

Replace at position pos with len copies of an item.

If there are existing elements at the positions to be replaced, then destructors are called before the space is used. The copy constructor is used to place the element into this 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 396 of file svector.h.

References STable< T >::data.

      /* Common replacement stuff. */
      pos = replaceCommon( pos, len );

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

Generated by  Doxygen 1.6.0   Back to index