comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@acm.nospam.org>
Subject: Re: Ada containers and custom allocators
Date: Wed, 09 Jan 2008 01:17:52 GMT
Date: 2008-01-09T01:17:52+00:00	[thread overview]
Message-ID: <4hVgj.291534$Fc.131494@attbi_s21> (raw)
In-Reply-To: <fb7764c5-31f9-488d-a0e6-53ffd6c96182@k39g2000hsf.googlegroups.com>

Maciej Sobczak wrote:
> On 8 Sty, 02:54, "Randy Brukardt" <ra...@rrsoftware.com> wrote:
> 
>>> Is it possible to set up a custom allocator for use with any given Ada
>>> container?
>> If you mean an allocator for the private data of the container (which
>> includes all of the elements and is the bulk of the container), the answer
>> is no.
> 
> This is exactly what I mean. It is not uncommon for a program to have
> a majority of its dynamic memory managed by containers.

Actually, Brukardt's reply is technically incorrect. The containers are tagged; 
you can derive from them and override the appropriate operations to obtain the 
behavior you require. Of course, this means you either have to know the 
internals of the container in question, or you have to override all the 
operations, effectively writing your own container.

Which brings us to

>> The standard Ada containers do not provide any mechanism to control
>> how/were the container allocates memory.
> 
> This limitation prevents programmers from doing many interesting
> optimizations. Even if we put performance issues aside, I might want
> to control the memory allocation for reliability.

The standard library is necessarily intended for general use, not optimized for 
any specific requirements. If it doesn't meet your specific requirements, then 
you should consider custom components that do.

-- 
Jeff Carter
"Gentlemen, you can't fight in here. This is the War Room!"
Dr. Strangelove
30



      parent reply	other threads:[~2008-01-09  1:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-07 15:48 Ada containers and custom allocators Maciej Sobczak
2008-01-07 16:29 ` Dmitry A. Kazakov
2008-01-08  1:54 ` Randy Brukardt
2008-01-08  7:59   ` Maciej Sobczak
2008-01-08 23:54     ` Randy Brukardt
2008-01-09  8:56       ` Dmitry A. Kazakov
2008-01-09 15:29         ` Robert A Duff
2008-01-09 17:09           ` Dmitry A. Kazakov
2008-01-09 21:58             ` Robert A Duff
2008-01-10 10:12               ` Dmitry A. Kazakov
2008-01-11  5:00           ` Randy Brukardt
2008-01-09 15:28       ` Robert A Duff
2008-01-11  5:00         ` Randy Brukardt
2008-01-11 21:02           ` Maciej Sobczak
2008-01-11 22:41             ` Robert A Duff
2008-01-12 13:40               ` Maciej Sobczak
2008-01-12 15:59                 ` Robert A Duff
2008-01-09  1:17     ` Jeffrey R. Carter [this message]
replies disabled

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