Delphi SetLength Custom Indexing
Posted
by Andreas Rejbrand
on Stack Overflow
See other posts from Stack Overflow
or by Andreas Rejbrand
Published on 2010-05-01T13:24:44Z
Indexed on
2010/05/01
13:27 UTC
Read the original article
Hit count: 216
In Delphi, it is possible to create an array of the type
var
Arr: array[2..N] of MyType;
which is an array of N - 1
elements indexed from 2 to N.
If we instead declare a dynamic array
var
Arr: array of MyType
and later allocate N - 1
elements by means of
SetLength(Arr, N - 1)
then the elements will be indexed from 0 to N - 2. Is it possible to make them indexed from 2 to N (say) instead?
© Stack Overflow or respective owner