You are here: Symbol Reference > MtxExpr Namespace > Classes > Vector Record > public > SetSubRange Method > Vector.SetSubRange Method (TMtxVec)
MtxVec VCL
ContentsIndex
PreviousUpNext
Vector.SetSubRange Method (TMtxVec)

Defines the calling vector to have the view of the same memory as Src.

Pascal
procedure SetSubRange(const Src: TMtxVec); overload;

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 is to be handled with greater 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 (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!