🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fr.comp.lang.ada
Article #63

Re: tableau à 2 dimensions

#63
From: letocha
Date: Fri, 11 Jan 2013 13:52
101 lines
3142 bytes
Le jeudi 10 janvier 2013 22:56:49 UTC+1, Ludovic Brenta a écrit :
> letocha writes:
> 
> >> Bien: cela permet d'utiliser des Vector avec la même syntaxe que les arrays. 
> 
> >
> 
> > Par contre, je ne comprends pas ce point.
> 
> 
> 
> Les explications ici:
> 
> 
> 
> http://www.adacore.com/adaanswers/gems/gem-123-implicit-dereferencing-in-ada-2012/
> 
> 
> 
> et les détails ici:
> 
> 
> 
> http://www.ada-auth.org/standards/12rm/html/RM-A-18-2.html
> 
> 
> 
> clauses 147.5/3 et suivantes.
> 
> 
> 
> En supposant ceci:
> 
> 
> 
>    package Vectors is new
> 
>      Ada.Containers.Vectors (Index_Type => Positive,
> 
>                              Element_Type => Integer);
> 
>    V : Vectors.Vector;
> 
> begin
> 
>    V.Append (12); -- ou bien: Vectors.Append (V, 12);
> 
> 
> 
> en Ada 2005 il fallait écrire:
> 
> 
> 
>    Ada.Integer_Text_IO.Put (V.Element (1)); -- ou bien: Vectors.Element (V, 1)
> 
>    V.Replace_Element (1, 42); -- ou bien: Vectors.Replace_Element (V, 1, 42)
> 
> 
> 
> mais Ada 2012 permet d'écrire:
> 
> 
> 
>    Ada.Integer_Text_IO.Put (V (1));
> 
>    V (1) := 42;
> 
> 
> 
> donc, comme pour un tableau à une dimension.  Pour des vectors de
> 
> vectors de vectors, la syntaxe serait:
> 
> 
> 
>    V (1) (2) (3) := 42;
> 
> 
> 
> et non pas
> 
> 
> 
>    T (1, 2, 3) := 42;
> 
> 
> 
> pour un tableau.
> 
> 
> 
> -- 
> 
> Ludovic Brenta.

Ok, en effet malgré ma lecture - certainement trop distraite - des RM2012, j'avais pas vu cette possibilité de faire un V(1):= avec un Vector.
Technical Details
Message-ID: <0261604d-a4ed-4881-bc16-ecbd7eadac4c@googlegroups.com>
Path: arc1-ca.pugleaf.net!k2ni1qap.0!nntp.google.com!p13no997871qai.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
References: <9928001f-5230-457b-a321-01f5267d8835@googlegroups.com> <78574204-c3be-4f4f-8c51-67be6750b9a8@googlegroups.com> <87fw28snvi.fsf@ludovic-brenta.org>

Show Full Headers
Complete Article Headers
X-Google-Thread: 43d0c745c,28fd0724845873a8
X-Google-Attributes: gid43d0c745c,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: FRENCH,ASCII
X-Received: by 10.224.110.68 with SMTP id m4mr9739732qap.2.1357912340070;
        Fri, 11 Jan 2013 05:52:20 -0800 (PST)
Received: by 10.49.84.167 with SMTP id a7mr13500538qez.11.1357912340021; Fri,
 11 Jan 2013 05:52:20 -0800 (PST)
Path: arc1-ca.pugleaf.net!k2ni1qap.0!nntp.google.com!p13no997871qai.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: fr.comp.lang.ada
Date: Fri, 11 Jan 2013 05:52:19 -0800 (PST)
In-Reply-To: <87fw28snvi.fsf@ludovic-brenta.org>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=195.101.77.179;
 posting-account=W5WOAwoAAADKJf0Mwbqw2yIGrYsfxIlw
NNTP-Posting-Host: 195.101.77.179
References: <9928001f-5230-457b-a321-01f5267d8835@googlegroups.com>
 <78574204-c3be-4f4f-8c51-67be6750b9a8@googlegroups.com> <87fw28snvi.fsf@ludovic-brenta.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0261604d-a4ed-4881-bc16-ecbd7eadac4c@googlegroups.com>
Subject: Re: tableau à 2 dimensions
From: letocha <faustogone@gmail.com>
Injection-Date: Fri, 11 Jan 2013 13:52:20 +0000
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable