associative arrays with manual memory management

Dmitry Olshansky via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Tue Aug 25 23:51:50 PDT 2015


On 24-Aug-2015 15:01, Ilya Yaroshenko wrote:
> http://code.dlang.org/packages/aammm/~master
>
> # aammm
> Associative arrays with manual memory management
>
> All enries and buckets would be dealocated and disposed by internal
> implementation's destructor.
> The destructor is called by garbage collector (by default).
>

Rox!

> #### Example
> ```D
>      //std.experimental.allocator is included into `aammm`
>      import std.experimental.allocator.mallocator;
>      import aammm;
>
>      auto a = AA!(string, int, shared Mallocator)(Mallocator.instance);

Sure hope a factory to do IFTI is available? So that the following works:

auto a  = aa!(string, int)(Mallocator.instance); // 3rd CT param is deduced

>      a["foo"] = 0;
>      a.remove("foo"); //dealocates and disposes the entry
>      assert(a == null); // should not crash
> ```



-- 
Dmitry Olshansky


More information about the Digitalmars-d-announce mailing list