Weird UFC and opCall issues

Darrell via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jan 3 13:37:29 PST 2015


Seems when creating your own ranges they can't be a class.
Must be a struct or Segmentation fault (core dumped) will follow.

This works as long as Test is a struct.

struct Test
{
   @property int front()
   {
     return 2;
   }

   void popFront()
   {
   }

   enum bool empty = false;
};

static assert(isInputRange!Test);

void mainx(){
   Test x;
   writeln(x.take(1));
}


More information about the Digitalmars-d-learn mailing list