www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Variant/Variant/Box wrappers?

reply Christopher Wright <dhasenan gmail.com> writes:
Hey --

I've got stuff that I want to work in dmd1/phobos, dmd2/phobos, and 
dmd1/tango. I really want to use boxing, since it'd make a lot of stuff 
easier, but there are three disparate structs to support: tango Variant, 
phobos Variant, and phobos Box.

Does anyone have wrappers for these? If so, do they handle structs of 
arbitrary sizes? (Phobos Variant doesn't, which makes it mostly useless 
without a wrapper anyway.)
Jan 05 2008
parent reply Dan <murpsoft hotmail.com> writes:
Christopher Wright Wrote:

 Hey --
 
 I've got stuff that I want to work in dmd1/phobos, dmd2/phobos, and 
 dmd1/tango. I really want to use boxing, since it'd make a lot of stuff 
 easier, but there are three disparate structs to support: tango Variant, 
 phobos Variant, and phobos Box.
 
 Does anyone have wrappers for these? If so, do they handle structs of 
 arbitrary sizes? (Phobos Variant doesn't, which makes it mostly useless 
 without a wrapper anyway.)

The way I did things was I rolled my own. In all honesty though, if you like the way one works, just use the actual source for it in your project. e:/dmd/src/phobos/std/boxer.d http://dsource.org/projects/walnut/browser/branches/1.9/source/value.d Something like that. Regards, Dan
Jan 06 2008
parent Christopher Wright <dhasenan gmail.com> writes:
Dan wrote:
 Christopher Wright Wrote:
 
 Hey --

 I've got stuff that I want to work in dmd1/phobos, dmd2/phobos, and 
 dmd1/tango. I really want to use boxing, since it'd make a lot of stuff 
 easier, but there are three disparate structs to support: tango Variant, 
 phobos Variant, and phobos Box.

 Does anyone have wrappers for these? If so, do they handle structs of 
 arbitrary sizes? (Phobos Variant doesn't, which makes it mostly useless 
 without a wrapper anyway.)

The way I did things was I rolled my own. In all honesty though, if you like the way one works, just use the actual source for it in your project. e:/dmd/src/phobos/std/boxer.d http://dsource.org/projects/walnut/browser/branches/1.9/source/value.d Something like that. Regards, Dan

Thanks, though I can't see how yours supports structs. I think I don't want to maintain any sort of custom box type; I've solved the problem with early casting of the stuff that's supposed to return variable-typed values.
Jan 06 2008