[fpc-pascal] Map of values to array of records

Jiří Pavlovský jira at getnet.cz
Sun Dec 25 23:07:47 CET 2011


On 25.12.2011 22:53, ik wrote:
> 2011/12/25 Jiří Pavlovský <jira at getnet.cz <mailto:jira at getnet.cz>>
>
>     Hello,
>
>     how can I create two level map where value is array of  records?
>     These  records are constant - I don't need to compute them or
>     anything.
>     I'm quite new to pascal and for gods sake cannot figure it out. I
>     tried to use TFPGMap for that.
>
>     I mean somewhere in the code I get two values and based on these I
>     need to get those records.
>
>     my dream would be something like
>     myArrayOfRecords := myMap[some_value][other_value];
>
>
> type
>    TMyRec = record
>      Field   : integer;
>      Empty,
>     Check : Boolean;
>    end;
>
>  TMyMap = array[0..Something] of TMyRec;

Thanks, but that is not want I need.
I don't want array, but a two level map where keys are not necessarily 
integers.



>
>
>
>     OTOH similar construct works in "const" section. So I'm quite puzzled.
>
>
> What do you mean ?
I mean the code below works ok, so I don't undestand why it doesn't 
compile when I use similar construct inside a function.
const ranges: array [1..2] of TMyRec =
      (
          (Start:    0;    Stop:    3),
          (Start:    4;    Stop:    7)
        );

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111225/bd704e92/attachment.html>


More information about the fpc-pascal mailing list