comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adambeneschan@gmail.com>
Subject: Re: Empty Bounded Containers
Date: Tue, 27 May 2014 07:50:04 -0700 (PDT)
Date: 2014-05-27T07:50:04-07:00	[thread overview]
Message-ID: <43be22bf-904b-4fb4-b8a8-de5bcef03cbb@googlegroups.com> (raw)
In-Reply-To: <c7ae9817-f4de-4159-8cd9-b920c7641492@googlegroups.com>

On Thursday, May 22, 2014 6:05:19 PM UTC-7, Adam Beneschan wrote:

I wrote:

> The assignment operator in Ada, however, isn't set up to copy "values" in a way that could change the representation, and it can't be overloaded the way assignment can in C++.  (This is actually a pretty cool feature of C++, as long as your program works perfectly the first time and never needs to be debugged or changed.)  What might be useful, that I don't see in the Bounded_Vectors spec, is a function that would return a vector with the same elements as an input parameter, but with a different capacity, e.g.
> 
> x : BC.Vector := BC.Copy_And_Change_Capacity (BC.Empty_Vector, Capacity => 42);

As Randy pointed out, there *is* already a function like that, Copy, that was added in Ada 2012.  I don't know how I missed it.  I looked through the RM chapter on Containers.Vectors several times looking for this, and I still couldn't find it.  Time to stop putting off that appointment with my ophthalmologist, I guess.

Sigh ...

                                -- Adam

  reply	other threads:[~2014-05-27 14:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-23  0:20 Empty Bounded Containers sbelmont700
2014-05-23  1:05 ` Adam Beneschan
2014-05-27 14:50   ` Adam Beneschan [this message]
2014-05-27 20:59     ` sbelmont700
2014-05-23  6:00 ` Simon Wright
2014-05-23 15:37   ` Adam Beneschan
2014-05-23 17:54     ` Simon Wright
2014-05-23 21:45 ` Randy Brukardt
replies disabled

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