2011/12/25 Jiří Pavlovský <j...@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; > > > I even tried to write a function that would return array of records based > on its parameters, but that does not work either. > I cannot figure out how to assign the record. > > This causes a compile error: > res[0] := (Field: 1; Empty: true; Check: false); > res[0].Field := 1; res[0].Empty := true; res[0].Check := false; if you want to make it as a function: function ToMyRec (AField : Integer; AEmpty, ACheck : Boolean) : TMyRec; begin Result.Field := AFiled; Result.Empty := AEmpty; Result.Check := AChek; end; res[0] := ToMyRec(...); > > > OTOH similar construct works in "const" section. So I'm quite puzzled. > What do you mean ? > > > Thank you > ______________________________**_________________ > fpc-pascal maillist - > fpc-pascal@lists.freepascal.**org<fpc-pascal@lists.freepascal.org> > http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal> >
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal