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-Thread: 103376,ad030c25af062445 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!j18g2000prn.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: How to include vector operators? Date: Mon, 6 Dec 2010 13:37:42 -0800 (PST) Organization: http://groups.google.com Message-ID: <838d2332-d88f-4010-ab8f-e56ca23a35b1@j18g2000prn.googlegroups.com> References: <1ba74849-bafa-499f-a448-661dff1f60bd@c39g2000yqi.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1291671462 1079 127.0.0.1 (6 Dec 2010 21:37:42 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 6 Dec 2010 21:37:42 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j18g2000prn.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:16795 Date: 2010-12-06T13:37:42-08:00 List-Id: On Dec 6, 1:03=A0pm, tolkamp wrote: > In my application the package Ada.Numerics.Generic_Real_Arrays =A0is > included. > > Code: > > with Ada.Numerics.Generic_Real_Arrays; > package Vectors is new Ada.Numerics.Generic_Real_Arrays(Float); > > How to include the vector operators like "+" and "-" ? > > I tried the follwing: > function "+" (Left, Right : Vectors.Real_Vector) return > Vectors.Real_Vector > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0renames > Ada.Numerics.Generic_Real_Arrays.Instantiations."+"; > > However this gives the error: > invalid prefix in selected component "Generic_Real_Arrays". function "+" (Left, Right : Vectors.Real_Vector) return Vectors.Real_Vector renames Vectors."+"; But you probably really want to use this, which will make all the operators visible: use type Vectors.Real_Vector; (and maybe the same for Real_Matrix). But NOT this: use type Ada.Numerics.Generic_Real_Arrays.Real_Vector; You can't access declarations in a generic package directly. You have to access the declarations in a generic *instance*. -- Adam