why allocators are not discussed here

Jacob Carlborg doob at me.com
Wed Jun 26 04:14:57 PDT 2013


On 2013-06-26 01:16, Adam D. Ruppe wrote:

> You'd want it to be RAII or delegate based, so the scope is clear.
>
> with_allocator(my_alloc, {
>       do whatever here
> });
>
>
> or
>
> {
>     ChangeAllocator!my_alloc dummy;
>
>     do whatever here
> } // dummy's destructor ends the allocator scope
>
>
> I think the former is a bit nicer, since the dummy variable is a bit
> silly. We'd hope that delegate can be inlined.

It won't be inlined. You would need to make it a template parameter to 
have it inlined.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list