comp.lang.ada
 help / color / mirror / Atom feed
From: Marius Amado-Alves <amado.alves@gmail.com>
Subject: Vector (container) initialization: the schizophrenic ampersand
Date: Thu, 17 May 2012 13:20:31 -0700 (PDT)
Date: 2012-05-17T13:20:31-07:00	[thread overview]
Message-ID: <10616734.43.1337286031745.JavaMail.geo-discussion-forums@vbjy7> (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.
*/



             reply	other threads:[~2012-05-17 20:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-17 20:20 Marius Amado-Alves [this message]
2012-05-17 20:24 ` Vector (container) initialization: the schizophrenic ampersand 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
replies disabled

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