<br><br><div class="gmail_quote">On Thu, Feb 11, 2010 at 21:22, GG <span dir="ltr">&lt;<a href="mailto:g@g.com">g@g.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I tried your trick but I got &quot;Error: cannot append type string to type VariantN!(maxSize)[]&quot;<br>
on :  vars ~= &quot;Jan&quot;;<br>
<br>
I found this : <a href="http://d.puremagic.com/issues/show_bug.cgi?id=3692" target="_blank">http://d.puremagic.com/issues/show_bug.cgi?id=3692</a>, the issue has been REOPEN.<br>
<br>
Thanks for helping !<br></blockquote><div><br>Hmm, it worked for me, but that was almost a year ago. Maybe I wrapped a Variant around?<br><br>vars ~= Variant(&quot;Jan&quot;);<br> <br></div></div>(*testing*)<br><br>Yes, it works:<br>
<br>Variant[] vars;<br>int[char[]][int] indices;<br><br>vars ~= Variant(&quot;Jan&quot;);<br>indices[0][&quot;Month&quot;] = vars.length-1;<br><br>Ugly as sin, though, and cumbersome to use. But I used it to add &#39;properties&#39; to nodes and edges in a graph class (like, adding weight to edges as double, and names to nodes as strings...) and it worked quite well, with a few functions to hide the trick away.<br>
<br>But it&#39;s sad you can&#39;t use Variant directly as a value. You can use it as a key, sort of:<br><br>int[Variant] test;<br>test[Variant(3)] = 4; // test[3] = 4 does not work<br>test[Variant(&quot;abc&quot;)] = 0;<br>
writeln(test[Variant(&quot;abc&quot;)]); // 0<br>auto k = test.keys; // crash! Assertion failure: &#39;impl&#39; on line 3886 in file &#39;mtype.c&#39;<br><br>