Mimicing Python list of list
Meta via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Oct 26 14:06:21 PDT 2015
On Monday, 26 October 2015 at 20:53:18 UTC, Dandyvica wrote:
> Thanks Meta, great idea.
>
> But does I'd like to have something like dynamic arrays and be
> able to do this:
>
> class A(T) { T _v; this(T v) { _v = v; } }
>
> auto myContainer = MyContainerArray!(A!int)();
>
> myContainer ~= new A!int(1);
> myContainer ~= new A!int(2);
>
> auto myInnerContainer = MyContainerArray!(A!int)();
> myInnerContainer ~= new A!int(3);
> myInnerContainer ~= new A!int(4);
>
> myContainer ~= myInnerContainer;
> myContainer ~= new A!int(5);
>
> I don't know if your implementation allows this?
There is a Red Black Tree implement in std.container.rbtree
(http://dlang.org/phobos/std_container_rbtree.html). I'm not sure
if it supports the concatenation operator or not, though.
More information about the Digitalmars-d-learn
mailing list