std.range this._input.opIndex(index) error

Tyro[a.c.edwards] nospam at home.com
Wed Apr 22 03:41:14 PDT 2009


Attempting to compile the following from snippet

     auto r = iota(0, 10, 1);
     assert(equal(r, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9][]));

from the documentation, I encountered following error

range.d(1184): Error: this._input.opIndex(index) is not an lvalue

Looking at the code I find "return _input[index];" on line 1184. The 
variable _input is defined as R _input in the template Take(R) which is 
the template instantiated to create iota. Problem is, it is not obvious 
why this doesn't work since the Range data variable "_input" is accessed 
the same way on multiple occasions throughout the file, a Range variable 
can obviously supports random access, and no attempt is being made to 
modify the range at this point in the code. Any information would be 
greatly appreciated?

Thanks in advance,
Andrew


More information about the Digitalmars-d-learn mailing list