comp.lang.ada
 help / color / mirror / Atom feed
* Incompatible types for array conversion
@ 2015-07-22  1:19 hreba
  2015-07-22  5:20 ` Niklas Holsti
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: hreba @ 2015-07-22  1:19 UTC (permalink / raw)


I have a generic vector package:

generic
    dim:		positive;
    type Real is digits <>;
package Vectors is
    type Vector is array (1..dim) of Real;
    function "*" (a: Vector; b: Real) return Vector;
end Vectors;

In another package I want to model the definition of a (physical) 
position vector by its direction and module:

package Basic is
    type Real is new Interfaces.IEEE_Float_64;
    type Length is new Real;

    package Positions is new Gen.Vectors (3, Length);
    package Directions is new Gen.Vectors (3, Real);

    subtype Position is Positions.Vector;
    subtype Direction is Directions.Vector;

    function "*" (l: Direction; r: Length) return Position;
end Basic;

Now my attempt to define this function:

    function "*" (l: Direction; r: Length) return Position is
    begin return Positions."*"(Position(l), r); end "*";

gets me the error message in the subject line.

Do I have to convert the vector element by element in a loop or is there 
a more elegant way?

-- 
Frank Hrebabetzky		+55 / 48 / 3235 1106
Florianopolis, Brazil

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-07-27 23:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-22  1:19 Incompatible types for array conversion hreba
2015-07-22  5:20 ` Niklas Holsti
2015-07-22  7:13   ` Simon Wright
2015-07-22  7:41     ` Niklas Holsti
2015-07-22 12:32       ` Simon Wright
2015-07-27 23:12         ` Randy Brukardt
2015-07-22 13:00   ` hreba
2015-07-22 13:22     ` hreba
2015-07-22 17:50       ` Niklas Holsti
2015-07-22 19:02         ` Dmitry A. Kazakov
2015-07-22  6:49 ` Georg Bauhaus
2015-07-22 12:57   ` hreba
2015-07-22 14:22     ` G.B.
2015-07-23 13:21 ` hreba

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