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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.70.102.205 with SMTP id fq13mr1934204pdb.6.1407243994059; Tue, 05 Aug 2014 06:06:34 -0700 (PDT) X-Received: by 10.140.107.137 with SMTP id h9mr22016qgf.16.1407243994007; Tue, 05 Aug 2014 06:06:34 -0700 (PDT) Path: border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!h18no14392482igc.0!news-out.google.com!b3ni5434qac.1!nntp.google.com!v10no4523168qac.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 5 Aug 2014 06:06:33 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=85.242.67.121; posting-account=nd46uAkAAAB2IU3eJoKQE6q_ACEyvPP_ NNTP-Posting-Host: 85.242.67.121 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <986b5653-f446-4833-9a83-426f45b7c03f@googlegroups.com> Subject: Problem with indefinite discriminant records in container From: john@peppermind.com Injection-Date: Tue, 05 Aug 2014 13:06:34 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: number.nntp.dca.giganews.com comp.lang.ada:188156 Date: 2014-08-05T06:06:33-07:00 List-Id: I want to store records of different size in Ada.Containers.Indefinite_Vect= ors: type Rt_Class (Method_Table_Size : MethodId; Superclass_Count : ClassId) is record Id : ClassId; Is_Interface : Boolean; Methods : Rt_Methods (1 .. Method_Table_Size); Superclasses : Rt_Class_Ids (1 .. Superclass_Count); Inst_Prop_Count : Natural; Method_Count : Natural; end record; package Class_Vectors is new Ada.Containers.Indefinite_Vectors (Index_Type =3D> ClassId, Element_Type =3D> Rt_Class); use Class_Vectors; type Rt_Classes is new Class_Vectors.Vector with null record; it compiles but I get a *runtime* error "instantiation error" with explanat= ion=20 "invalid constraint: type has no discriminant" when the above package is in= stantiated. Rt_Methods and Rt_Class_Ids are array types and all of this occurs in the p= rivate part of a package.=20 How can I store different versions of an indefinite record with discriminan= ts such as Rt_Class in some array or vector? Using access types would be ve= ry hard if not impossible in this case because of the associated scope rest= rictions. Somewhat annoying in this case is also that this table/array only= needs to be created *once* in the beginning of program execution and other= wise is completely static and read-only ... and access should be as fast as= possible. Any ideas or suggestions?