You can roll your own tagged union instead. The S struct can store long and byte[], S.ptr is a pointer to the data.<div><br></div><div><div> enum Type { Long, Bytes }</div><div> struct S {</div><div> Type type;</div>
<div> void* ptr;</div><div> union {</div><div> long _long;</div><div> byte[] _bytes;</div><div> }</div><div> this(long l) {</div><div> _long = l;</div><div> type = Type.Long;</div>
<div> ptr = &_long;</div><div> }</div><div> this(byte[] bytes) {</div><div> _bytes = bytes;</div><div> type = Type.Bytes;</div><div> ptr = &_long;</div><div>
}</div><div> }</div><div> </div><div> auto s = S(99);</div><div> assert(s.ptr == &(s._long));</div><div> assert(s.ptr == &(s._bytes));</div><div><br></div>Pedro Lacerda<br><br>
<br><br><div class="gmail_quote">2012/2/7 Jesse Phillips <span dir="ltr"><<a href="mailto:jessekphillips%2BD@gmail.com">jessekphillips+D@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Tuesday, 7 February 2012 at 00:39:00 UTC, Era Scarecrow wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Unfortunately I'd need to reference a buffer for the known structured types. Variant seems far more useful for making an interpreted language, than for my purposes.<br>
</blockquote>
<br></div>
I've been using Variant with LuaD for some time. Sorry it isn't what you need but hopefully you'll know when it will be useful.<br>
</blockquote></div><br></div>