From: Per Sandberg <per.s.sandberg@bahnhof.se>
Subject: Re: Ada.Containers.Vectors
Date: Mon, 26 Jun 2017 20:06:02 +0200
Date: 2017-06-26T20:06:02+02:00 [thread overview]
Message-ID: <e2c4B.78044$_H1.46111@fx10.fr7> (raw)
In-Reply-To: <3516c666-ef65-4e54-89e9-03f14f293493@googlegroups.com>
Hi
A answer is that the compiler don't know if it should use the "=" for
"Constant_Reference_Type'(F (J)))" or "Integer'(F (J))".
Its a bit like:
---------------------------------------
procedure put(Item : Integer);
procedure put(Item : Long_Integer);
procedure put(Item : Long_Long_Integer);
----------------------
And then in the code:
put(2);
-- This wont compile you have to state one of the following:
put(Integer'(2));
put(Long_Integer'(2));
put(Long_Long_Integer'(2));
/Per
Den 2017-06-26 kl. 18:39, skrev hnptz@yahoo.de:
> Here is my code:
>
> with Ada.Containers; use Ada.Containers;
> with Ada.Containers.Vectors;
> package RGF is
> package IV is new Vectors(Natural,Integer);
> use IV;
> procedure GenerateRGF(m : Integer;
> f : in out Vector);
> end RGF;
>
> package body RGF is
> use IV;
> procedure GenerateRGF(m : Integer;
> f : in out Vector) is
> done : Boolean := False;
> fmax : Vector;
> j : Integer;
> begin
> for i in 1..m loop
> f(i):=1;
> fmax(i) := 2;
> end loop;
> while not done loop
> j := m+1;
> loop
> j := j-1;
> exit when f(j) /= fmax(j);
> end loop;
> if j > 1 then
> f(j) := f(j)+1;
> for i in j+1 .. m loop
> f(i):=1;
> if f(j) = fmax(j) then
> fmax(i):=fmax(j)+1;
> else
> fmax(i):=fmax(j);
> end if;
> end loop;
> else
> done := True;
> end if;
> end loop;
> end GenerateRGF;
>
> end RGF;
>
> As a result I get "ambiguous operands for equality" for /= and =. How to resolve these ambiguities?
>
> Best,
>
> Gilbert
>
>
>
next prev parent reply other threads:[~2017-06-26 18:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-26 16:39 Ada.Containers.Vectors hnptz
2017-06-26 18:06 ` Per Sandberg [this message]
2017-06-27 6:15 ` Ada.Containers.Vectors G.B.
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox