Error: variable i cannot be read at compile time
Ali Çehreli
acehreli at yahoo.com
Thu Jan 4 18:49:21 UTC 2018
On 01/04/2018 08:51 AM, Vino wrote:
> auto read () {
[...]
> return tuple(Ucol1, Ucol2, Ucol3, rSize);
> }
read() returns a tuple of values of different types.
> for(int i = 0; i < Size; i++) {
> typeof(read()[i]) Datacol;
typeof is a compile-time expression but there cannot be a consistent
result to that expression when i is not known at compile-time.
You might try using a 'static foreach' but this time Size is not a
compile-time expression:
static foreach(i; 0 .. Size) {
typeof(read()[i]) Datacol;
Error: variable Size cannot be read at compile time
Ali
More information about the Digitalmars-d-learn
mailing list