www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Variadic opIndexAssign

reply AJG <AJG_member pathlink.com> writes:
Hi,

I'm using a variadic version of opIndexAssign, and it seems to work. I dunno if
this is a hack or not, but what the heck. In addition, I'm using std.boxer
internally. The problem is that I can't streamline the parameter-to-box
conversion. Here's an example:

















My question is, what do I put in __UNKNOWN__?

Plan B is to do a manual type-by-type test, like:






But this would really suck, as it ruins the whole thing. Surely there's a way to
automate that bit of nastiness so that I can do something like:



Right?

Thanks a ton for the help.
--AJG.
Aug 14 2005
parent reply "Ben Hinkle" <ben.hinkle gmail.com> writes:


something like Box b = box(_arguments[0],_argptr); _argptr += (_arguments[0].tsize() + int.sizeof - 1) & ~(int.sizeof - 1); Someone really should put that argptr increment in a standard place. It's come up twice recently...
Aug 14 2005
parent reply AJG <AJG_member pathlink.com> writes:
Hi,

something like

 Box b = box(_arguments[0],_argptr);
Nice! :)
 _argptr += (_arguments[0].tsize() + int.sizeof - 1) & ~(int.sizeof - 1);
I don't get this part. How come the example in the docs doesn't do that?
Someone really should put that argptr increment in a standard place. It's 
come up twice recently... 
Thanks! --AJG.
Aug 14 2005
parent AJG <AJG_member pathlink.com> writes:
 _argptr += (_arguments[0].tsize() + int.sizeof - 1) & ~(int.sizeof - 1);
I don't get this part. How come the example in the docs doesn't do that?
Oh, nevermind. I'm a doofus. It's because you didn't use the template macro to get the arg. Right?
Someone really should put that argptr increment in a standard place. It's 
come up twice recently... 
Yes, this seems like a good idea. Cheers, --AJG.
Aug 14 2005