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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,39f3c359196fe8b4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-20 09:19:54 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!82-43-33-254.cable.ubr01.croy.blueyonder.co.UK!not-for-mail From: "Nick Roberts" Newsgroups: comp.lang.ada Subject: Re: for x'address or variant Date: Sun, 20 Apr 2003 17:19:54 +0100 Message-ID: References: NNTP-Posting-Host: 82-43-33-254.cable.ubr01.croy.blueyonder.co.uk (82.43.33.254) X-Trace: fu-berlin.de 1050855593 4893922 82.43.33.254 (16 [25716]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Xref: archiver1.google.com comp.lang.ada:36320 Date: 2003-04-20T17:19:54+01:00 List-Id: "kat-Zygfryd" <6667@wp.pl> wrote in message news:b7u1jh$p6k$1@news.onet.pl... > I have a tiny problem, I want to have a structure: > type P is access X; > type X is record > next: array(1..2) of P; > left: P; > right: P; > end record; > wherein the left component uses next(1)'address > and right component uses next(2)'address, > unfortunately "for x'address use" statements are > not allowed within record declarations, and > variant records don't allow me to access both > next and left/right exchangably. do you know a way > to work this out? Declare the following: type Node; type Node_Ref is access Node; type Leaf_Direction is (Left, Right); type Leaf_Pair is array (Leaf_Direction) of Node_Ref; type Node is record Payload: ...; Leaves: Leaf_Pair; end record; Now you can reference, for example, the left leaf an object X1 of type Node by: X1.Leaves(Left).all You can cycle through all the leaves of X1 by: for L in Leaf_Direction loop ... X1.Leaves(L).all ... end loop; I hope this solves the problem. Say if it doesn't. -- Nick Roberts Jabber: debater@charente.de [ICQ: 159718630]