You are here: Symbol Reference > MtxExprInt Namespace > Classes > VectorInt Record > public > SetSubRange Method > VectorInt.SetSubRange Method (TMtxVecInt)
MtxVec VCL
ContentsIndex
PreviousUpNext
VectorInt.SetSubRange Method (TMtxVecInt)

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

Pascal
procedure SetSubRange(const Src: TMtxVecInt); 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 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. It is therefore recommended to contstrain the use of the Subrange within the scope of one routine.

Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!