comp.lang.ada
 help / color / mirror / Atom feed
From: tolkamp <f.tolkamp@gmail.com>
Subject: Re: How to include vector operators?
Date: Tue, 7 Dec 2010 03:11:17 -0800 (PST)
Date: 2010-12-07T03:11:17-08:00	[thread overview]
Message-ID: <294277bf-c947-40e4-86ec-3071e33b5adb@l17g2000yqe.googlegroups.com> (raw)
In-Reply-To: 838d2332-d88f-4010-ab8f-e56ca23a35b1@j18g2000prn.googlegroups.com

On 6 dec, 22:37, Adam Beneschan <a...@irvine.com> wrote:
> 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- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -

Thank you for your solution. Now it works correct.

Fred



  reply	other threads:[~2010-12-07 11:11 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
2010-12-07 11:11   ` tolkamp [this message]
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