opDollar and infinite slices on infinite ranges
Robert Jacques
sandford at jhu.edu
Sun Jul 18 18:03:02 PDT 2010
On Sun, 18 Jul 2010 17:48:56 -0400, Philippe Sigaud
<philippe.sigaud at gmail.com> wrote:
> On Sat, Jul 17, 2010 at 22:01, Philippe Sigaud
> <philippe.sigaud at gmail.com>wrote:
>
>>
>> My google-fu is weak, I cannot find any indication on opDollar and how
>> to
>> define it, for D2. So, maybe someone here can help me? Can someone
>> points
>> me
>> to some documentation?
>>
>>
> No, no one knows something about opDollar and how to define it?
>
> Pretty please?
>
>
> Philippe
A well designed opDollar is still an enhancement request:
http://d.puremagic.com/issues/show_bug.cgi?id=3474. However, there is a
hack to get $ to return a value. Unfortunately, I've lost that newsgroup
post.
Memory got me this code snippet:
struct Bar {
int opIndex(int i) { writeln(i); return i; }
}
int __dollar() { return 5;}
void main(string[] args) {
Bar b;
b[$];
}
More information about the Digitalmars-d
mailing list