digitalmars.D - Does opSliceAssign exist?
- AJG (5/5) Sep 21 2005 I've seen it in some files on the web. However, I don't think it works.
- Jarrett Billingsley (11/14) Sep 22 2005 Nope. I asked the same question a couple months ago, but never really g...
I've seen it in some files on the web. However, I don't think it works. Or at any rate, is there a way to overload the following? MyObject[] = 5; Thanks, --AJG.
Sep 21 2005
"AJG" <AJG_member pathlink.com> wrote in message news:dgtfk9$2h4q$1 digitaldaemon.com...I've seen it in some files on the web. However, I don't think it works. Or at any rate, is there a way to overload the following? MyObject[] = 5;Nope. I asked the same question a couple months ago, but never really got a satisfactory answer (i.e. one from Walter ;) ). There's really no good reason that I can see for the omission. I would even be happy if instead of having an explicitly overloadable opSliceAssign, it would simply call opIndexAssign on the given range of elements, as most of the time, that's all the code for a custom opSliceAssign would be. However this would lead to sticky situations when you had, say, an opIndexAssign(char[] index); it's just not possible for the compiler to create a range such as a["fork".."knife"].
Sep 22 2005