comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Emulating placement new
Date: Sun, 29 Jul 2012 16:10:58 +0200
Date: 2012-07-29T16:10:58+02:00	[thread overview]
Message-ID: <5j0ucqxb38j$.6c4x5hrz3wmw.dlg@40tude.net> (raw)
In-Reply-To: 87vch67jsk.fsf@mid.deneb.enyo.de

On Sun, 29 Jul 2012 15:56:27 +0200, Florian Weimer wrote:

> Is there a way to specify a storage pool (or something similar) on the
> allocator, and not on the access type?

Qualified expression?

   Access_Type'(new T)

Maybe something like this:

   function Allocate_In (Pool : in out Root_Storage_Pool'Class)
       return not null access T is
       type T_Ptr is access T;
       for T_Ptr'Storage_Pool use Pool;
       Ptr : T_Ptr;
   begin
       Ptr := new T;
       return Ptr.all'Unchecked_Access;
   end Allocate_In;

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2012-08-06 17:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-29 13:56 Emulating placement new Florian Weimer
2012-07-29 14:10 ` Dmitry A. Kazakov [this message]
2012-07-29 14:15   ` Florian Weimer
2012-07-29 14:25     ` Dmitry A. Kazakov
2012-07-29 15:00 ` Georg Bauhaus
2012-07-29 16:04 ` Robert A Duff
2012-07-29 18:48   ` Florian Weimer
2012-07-29 19:14     ` Robert A Duff
replies disabled

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