Class
TVec
Declaration
Procedure SetSubRange(Src: TMtxVec; Index: integer; Len: integer = MtxVecEOA);
Description
Define a subvector of the Src vector starting at Index and ending at Index+Len-1.
Declaration
Procedure SetSubRange(Src: TMtxVec);
Description
Defines the calling vector to have the view of the same memory as Src. Src vector's Length property may not change while any other object has it's own view of it.
a.SetSubRange(b,..);
This SetSubRange method must be handled with great care. Namely:
- b can be freed before "a" and accessing "a" gives AV.
- a can be further subranged with c and same problem occurs when b is freed before c.
- If you resize b, all objects which have subranged b are no longer pointing to valid memory.
- b can Subrange other objects. Similar problem as when changing the size of b. Again all objects which have subranged b are not longer pointing to valid memory.
All this can lead to hard to find bugs.
| Copyright 2008 Dew Research |
http://www.dewresearch.com