Re: Nesting Variants

2013-06-13 Thread Timothee Cour
On Sun, May 19, 2013 at 4:31 PM, Wyatt wyatt@gmail.com wrote: I'm trying to use Variants and ran into the following sort of situation: //Using DMD 2.062 import std.stdio; import std.variant; void main(){ int key = 1; Variant[] one; Variant[] ender;

Re: Nesting Variants

2013-05-22 Thread Wyatt
On Monday, 20 May 2013 at 08:55:24 UTC, evilrat wrote: yes, you forgot to take exact value, it doesn't know anything about array you put it in, so if you take that array explicitly and put value on array element it would work ender[0] = one; ender[0].get!(Variant[])[0] = key;

Re: Nesting Variants

2013-05-22 Thread evilrat
On Wednesday, 22 May 2013 at 01:04:35 UTC, Wyatt wrote: I was trying to do this as a way to obtain a concise syntax for manipulating a tree of elements deserialized at runtime, ex: data[foo][bar] = baz; assert( data[foo][bar] == baz ); foreach( subtree; data[foo] ) doSubtreeOp( subtree );

Re: Nesting Variants

2013-05-22 Thread gedaiu
what about this class? https://bitbucket.org/szabo_bogdan/cmsushid/raw/e2e4d2195bf48df586887768d2d800d21227c80d/src/base/Value.d

Re: Nesting Variants

2013-05-20 Thread evilrat
On Sunday, 19 May 2013 at 23:31:11 UTC, Wyatt wrote: I'm trying to use Variants and ran into the following sort of situation: //Using DMD 2.062 import std.stdio; import std.variant; void main(){ int key = 1; Variant[] one; Variant[] ender; one = new

Nesting Variants

2013-05-19 Thread Wyatt
I'm trying to use Variants and ran into the following sort of situation: //Using DMD 2.062 import std.stdio; import std.variant; void main(){ int key = 1; Variant[] one; Variant[] ender; one = new Variant[](1); ender = new Variant[](1); //This