From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,FREEMAIL_FROM, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,d67ca8d922a33c8a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-02-29 18:22:41 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!wn51feed!worldnet.att.net!attbi_s03.POSTED!not-for-mail From: "Steve" Newsgroups: comp.lang.ada References: Subject: Re: Heterogenous array X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: NNTP-Posting-Host: 24.20.111.157 X-Complaints-To: abuse@comcast.net X-Trace: attbi_s03 1078107759 24.20.111.157 (Mon, 01 Mar 2004 02:22:39 GMT) NNTP-Posting-Date: Mon, 01 Mar 2004 02:22:39 GMT Organization: Comcast Online Date: Mon, 01 Mar 2004 02:22:40 GMT Xref: archiver1.google.com comp.lang.ada:5963 Date: 2004-03-01T02:22:40+00:00 List-Id: Change your type definition to have a default descriminant: type Parameter_Definition(Param_Type:T_Param_Type:=Int) is record ... You'll also find that to assign to one of the elements in the array, you need to do a full record assignment to establish the type. Once the type is set you can manipulate individual field values if needed. Steve (The Duck) "Bj�rn Persson" wrote in message news:pIw0c.84623$dP1.233768@newsc.telia.net... I need an array type that can hold elements of different types. My current attempt (somewhat simplified) is below. My question is, is there a way to do this without pointers? type T_Param_Type is (Int, Str); type Parameter_Definition(Param_Type : T_Param_Type) is record Name : A_Bounded_String_Type; case Param_Type is when Int => Min : Integer; Max : Integer; Int_Value : Integer; when Str => Str_Value : Ada.Strings.Unbounded.Unbounded_String; end case; end record; type Parameter_Definition_Pointer is access Parameter_Definition; type Parameter_Spec is array(Positive range <>) of Parameter_Definition_Pointer; "array(Positive range <>) of Parameter_Definition" gave me the error "unconstrained element type in array declaration". I also tried a tagged type with subtypes and "array(Positive range <>) of Parameter_Definition'Class", and got the same error. This isn't really a dynamic data structure so I feel that pointers shouldn't be necessary. Any ideas? -- Bj�rn Persson jor ers @sv ge. b n_p son eri nu