www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - opIndexAssign Question

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

I believe right now, if you do:


It is equivalent to:


If you do:


It's equivalent to:


And finally, if you do:


It is equivalent to:

meaning:


Is that all correct?

------------

If so, is there a way to get


to be equal to:

instead?
or maybe:

Meaning a typesafe variadic array?

Thanks,
--AJG.
Aug 20 2005
parent reply "Ben Hinkle" <ben.hinkle gmail.com> writes:
"AJG" <AJG_member pathlink.com> wrote in message 
news:de8a35$1tte$1 digitaldaemon.com...
 Hi,

 I believe right now, if you do:


 It is equivalent to:


 If you do:


 It's equivalent to:


 And finally, if you do:


 It is equivalent to:

 meaning:


 Is that all correct?
It should be, yeah.
 ------------

 If so, is there a way to get


 to be equal to:

 instead?
 or maybe:

 Meaning a typesafe variadic array?
not without changing the language. You might want to try a method instead of using opIndexAssign. Something like Foo.insert(char[] key, int[] data...)
 Thanks,
 --AJG.
Aug 20 2005
parent AJG <AJG_member pathlink.com> writes:
Hi,

 If so, is there a way to get


 to be equal to:

 instead?
 or maybe:

 Meaning a typesafe variadic array?
not without changing the language. You might want to try a method instead of 
using opIndexAssign. Something like Foo.insert(char[] key, int[] data...)
Ah, ok. Speaking of which, how come the variadic part of the function signature can't come ahead of the fixed part? For example: Thanks, --AJG.
Aug 20 2005