comp.lang.ada
 help / color / mirror / Atom feed
* Vector (container) initialization: the schizophrenic ampersand
@ 2012-05-17 20:20 Marius Amado-Alves
  2012-05-17 20:24 ` Jeffrey Carter
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Marius Amado-Alves @ 2012-05-17 20:20 UTC (permalink / raw)


Shouldn't this be the right idiom to initialize a vector (container) with literals:

use My_Vectors;
V : My_Vectors.Vector := Element1 & Element2 & Element3;

Looks nice, but does not compile (with GNAT), because the compiler cannot make a decision on which "&" function to use where. Is there a way to give precedence to one of the "&" functions? Or some other nice solution? Thanks.

/*
My current solution is to rename one of the functions:

use My_Vectors;

function "+" (L : My_Vectors.Vector; R : My_Element_Type)
   renames My_Vectors."&";

V : My_Vectors.Vector := Element1 & Element2 + Element3;

Not elegant at all.
*/



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

end of thread, other threads:[~2012-05-21 18:00 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-17 20:20 Vector (container) initialization: the schizophrenic ampersand Marius Amado-Alves
2012-05-17 20:24 ` Jeffrey Carter
2012-05-17 20:26 ` Pascal Obry
2012-05-17 23:33 ` Adam Beneschan
2012-05-18  6:34   ` Marius Amado-Alves
2012-05-18  6:51   ` Marius Amado-Alves
2012-05-18 13:31     ` Robert A Duff
2012-05-18 18:55       ` Shark8
2012-05-18 22:44         ` Robert A Duff
2012-05-19  9:03       ` Marius Amado-Alves
2012-05-19 16:15         ` Robert A Duff
2012-05-21 16:02           ` Adam Beneschan
2012-05-21 17:04             ` Robert A Duff
2012-05-21 17:57               ` Adam Beneschan
2012-05-21 15:57         ` Adam Beneschan
2012-05-19  9:28     ` Dmitry A. Kazakov

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