comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: How to include vector operators?
Date: Mon, 6 Dec 2010 13:37:42 -0800 (PST)
Date: 2010-12-06T13:37:42-08:00	[thread overview]
Message-ID: <838d2332-d88f-4010-ab8f-e56ca23a35b1@j18g2000prn.googlegroups.com> (raw)
In-Reply-To: 1ba74849-bafa-499f-a448-661dff1f60bd@c39g2000yqi.googlegroups.com

On Dec 6, 1:03 pm, tolkamp <f.tolk...@gmail.com> wrote:
> In my application the package Ada.Numerics.Generic_Real_Arrays  is
> 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
>                renames
> 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




  reply	other threads:[~2010-12-06 21:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-06 21:03 How to include vector operators? tolkamp
2010-12-06 21:37 ` Adam Beneschan [this message]
2010-12-07 11:11   ` tolkamp
2010-12-07  2:53 ` Gautier write-only
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox