Vector.Create Constructor

Overload List

#SignatureDescription
1constructor Create(const Src: TVec);Uses TVec object as internal storage.
2constructor Create(FromObjectCache: Boolean);Constructor of the record.
3constructor Create(const ALength: Integer; const aFloatPrecision: TMtxFloatPrecision);Internally creates TVec object without using object cache.
4constructor Create(const ALength: Integer; const aIsComplex: Boolean; const aIsDouble: Boolean);Constructor of the record.

Overload 1: constructor Create(const Src: TVec);

Uses TVec object as internal storage.

#NameTypeDescription
1SrcTVec

Result: stored in self (calling object)

Remarks:

The resulting Vector will own Src object of TVec type and will release it once Vector gets out of scope.

Overload 2: constructor Create(FromObjectCache: Boolean);

Constructor of the record.

#NameTypeDescription
1FromObjectCacheBoolean

Result: stored in self (calling object)

Remarks:

Returns a Vector with internal TVec object created from object cache (CreateIt), if FromObjectCache is True. Pass false to the constructor, if the variable is a global variable. Object cache has limited size and is to be used only for local variables.

Overload 3: constructor Create(const ALength: Integer; const aFloatPrecision: TMtxFloatPrecision);

Internally creates TVec object without using object cache.

#NameTypeDescription
1ALengthInteger
2aFloatPrecisionTMtxFloatPrecision

Result: stored in self (calling object)

Remarks:

Creates TVec object without using object cache. Suitable for declaring global variables.

Overload 4: constructor Create(const ALength: Integer; const aIsComplex: Boolean; const aIsDouble: Boolean);

Constructor of the record.

#NameTypeDescription
1ALengthInteger
2aIsComplexBoolean
3aIsDoubleBoolean

Result: stored in self (calling object)

Remarks:

Returns a Vector with internal TVec object created explicitely with Length property set to aLength and Complex property set to IsComplex. Call this constructor, if the Vector type variable is a global variable with a long life span.

Examples
var a,b: Vector;
    bvec: TVec;
begin
    a := Vector.Create(true); //create from object cache via CreateIt

    //this constructor can be omitted, because it is implictely called
    //the first time that the variable is used.
    //However:

    b := Vector.Create(10);

    //Similar to

    bvec := TVec.Create;
    try
        bvec.Size(10);
    finally
        bvec.Free;  //b is freed on the exit from the procedure
    end;
end;
See Also: TVec.Equal, TMtxVec.IsEqual