Thread overview | |||||
---|---|---|---|---|---|
|
October 03, 2005 opSlice question | ||||
---|---|---|---|---|
| ||||
class A { A opSlice() { return new A(); } A opSlice(int a, int b) { return new A(); } } void main() { A a = new A(); A aa = a[1,2]; } ####################### dmd slice.d -I~/dmd/src/phobos slice.d(19): no [] operator overload for type slice.A ####################### What's wrong here? the code or DMD? thanks, Ant |
October 03, 2005 Re: opSlice question | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | Ant wrote:
> class A
> {
> A opSlice()
> {
> return new A();
> }
> A opSlice(int a, int b)
> {
> return new A();
> }
> }
>
> void main()
> {
> A a = new A();
> A aa = a[1,2];
> }
> #######################
> dmd slice.d -I~/dmd/src/phobos
> slice.d(19): no [] operator overload for type slice.A
> #######################
> What's wrong here? the code or DMD?
>
> thanks,
> Ant
off the top of my head I see this problem:
> A aa = a[1,2];
should be:
#A aa = a[1..2]
|
October 03, 2005 Re: opSlice question | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hasan Aljudy | Hasan Aljudy wrote:
> off the top of my head I see this problem:
> > A aa = a[1,2];
> should be:
> #A aa = a[1..2]
thanks, time to go to sleep... :p
Ant
|
Copyright © 1999-2021 by the D Language Foundation