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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a24:5f93:: with SMTP id r141mr3278689itb.4.1548274928604; Wed, 23 Jan 2019 12:22:08 -0800 (PST) X-Received: by 2002:aca:cc0f:: with SMTP id c15mr84527oig.3.1548274928518; Wed, 23 Jan 2019 12:22:08 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.166.216.MISMATCH!q69no37280itb.0!news-out.google.com!v71ni35ita.0!nntp.google.com!q69no37279itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 23 Jan 2019 12:22:08 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=146.5.2.29; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 146.5.2.29 References: <3d782720-227d-4d86-b403-eacbd1b9d0d2@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <06c9823b-eaa1-49ea-a8fb-9a5704ac06b3@googlegroups.com> Subject: Re: Problem with Position of the enumeration Type From: Shark8 Injection-Date: Wed, 23 Jan 2019 20:22:08 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:55343 Date: 2019-01-23T12:22:08-08:00 List-Id: On Wednesday, January 23, 2019 at 5:30:24 AM UTC-7, Luis Ladron de Guevara Moreno wrote: > > the numbers 10, 11, 12... was the position of the enumeration and when i tried to use ex. 'Pos(Pos12) i obtained a 2. The position of the values cannot be modified. these values are the representation of the enum, i understand. That's correct -- 'Pos gives you the position in the ordered-set of the enumeration, and 'Val does the inverse. What you want is Unchecked_Conversion, to do this well you want to specify the sizes so they match up. Type Enum_Reps is range 10..14 -- You could hide this in the private section, with Size => Natural'Size; -- and have renaming-as-a-body for the actual -- conversion functions. Function Convert is new Unchecked_Conversion( E_Test, Enum_Reps ); Function Convert is new Unchecked_Conversion( Enum_Reps, E_Test ); and then just use Convert.