Weird UFC and opCall issues

Darrell via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jan 3 12:56:52 PST 2015


Ooops.
Test() wasn't valid.
Still working to create a range object that iterates over an 
internal data struct. But this was may error.


On Saturday, 3 January 2015 at 20:26:41 UTC, Darrell wrote:
> Fails with:
>     t.d(34): Error: need 'this' for 'opCall' of type 'int()'
>
> Also opCall seems to be required to create a range.
>
> class Test
> {
>   int opCall()
>   {
>     return 1;
>   }
>
>   @property int front()
>   {
>     return 2;
>   }
>
>   void popFront()
>   {
>   }
>
>   @property bool empty()
>   {
>     return false;
>   }
>
> };
>
> void main(){
>   ubyte [] p1;
>   Test();
> }



More information about the Digitalmars-d-learn mailing list