TVecInt::Select Method

Overload List

#SignatureDescription
1void Select(int Index, int Len);Selects a set of elements from the vector.
2void Select();Resets the selection.

Overload 1: void Select(int Index, int Len);

Selects a set of elements from the vector.

#NameTypeDescription
1Indexint
2Lenint
Remarks:

The method will define a subarray starting at Index and ending at Index+Len-1. No copying will occur, only pointers will be shifted.

All values of the original TMtxVec will be preserved. An exception will be raised if an attempt is made to change the size of the calling object after a selection has been made.

A selection will behave exactly as if the object always contained only the selected values. When a selection is made from another object the source object and all operations done on either of the two objects will affect the same elements. The use of selections increases CPU cache reuse, lower's memory requirements, increases application performance and improves code readability.

To again obtain a view of the full vector/matrix use the TVecInt::SelectAll method.

When selecting elements from other objects, care must be given not to use the selections after the source object has been freed:

var a,b: TVec;
begin
    CreateIt(a,b);
    try
        a.SetIt(False,[1,2,3,4]);
        b.Select(a,2,2);

        FreeIt(a); //free the source object

        b.Values[0] := b.Valuess[1]; //b does not point to valid memory anymore
    finally
        FreeIt(a);
    end;
end;
Declared in Dew::Math::TMtxVecBase · Dew.Math/MtxVecBase.h · Cross-compiler

Overload 2: void Select();

Resets the selection.

Remarks:

This method is the same as the TVecInt::SelectAll method.

Declared in Dew::Math::TMtxVecBase · Dew.Math/MtxVecBase.h · Cross-compiler