comp.lang.ada
 help / color / mirror / Atom feed
From: Adrien Plisson <aplisson-news@stochastique.net>
Subject: Re: Dynamic array allocation and STL equivalents?
Date: Fri, 11 Feb 2005 16:50:31 +0100
Date: 2005-02-11T16:50:31+01:00	[thread overview]
Message-ID: <420cd447$0$23755$ba620e4c@news.skynet.be> (raw)
In-Reply-To: <13r5d1sfsg55d$.1u0p9rdnt3zcy.dlg@40tude.net>

Dmitry A. Kazakov wrote:
> Index of a multi-dimensional array is a tuple. That won't work in C++ (you
> cannot override "," to support: A[i,j,k]). Neither works it in Ada.

in C++, you can override "," ("," is an operator as any others). but 
you should really not do this: some people use this operator 
extensively for brevity or just because they want to put multiple 
expressions where they should only put one (eg, in the condition of a 
"if" statement).

but you may override operator [] to take a parameter of type 
std::vector, as suggested by the OP. it may render the element access 
syntax not obvious, but it is comparable to the Ada solution you wrote.

-- 
rien



  reply	other threads:[~2005-02-11 15:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-11 13:06 Dynamic array allocation and STL equivalents? brian.b.mcguinness
2005-02-11 13:43 ` Jeff C
2005-02-14 15:23   ` Marc A. Criley
2005-02-11 14:41 ` Dmitry A. Kazakov
2005-02-11 15:50   ` Adrien Plisson [this message]
2005-02-11 17:47   ` REH
2005-02-12  9:28     ` Dmitry A. Kazakov
2005-02-12 18:52       ` Robert A Duff
2005-02-11 17:24 ` Bobby D. Bryant
2005-02-12  0:06   ` Robert A Duff
2005-02-12  3:45     ` Bobby D. Bryant
2005-02-11 18:07 ` Matthew Heaney
2005-02-11 18:36   ` Martin Krischik
2005-02-11 19:35 ` brian.b.mcguinness
2005-02-12  1:04 ` Jeffrey Carter
2005-02-12  6:19 ` Bobby D. Bryant
replies disabled

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