variable x cannot be read at compile time (ctfe)

maarten van damme maartenvd1994 at gmail.com
Mon Dec 17 01:42:40 PST 2012


I finally got around trying to finish my sudoksolver and I'm pretty
happy with the result, except one little piece that screams for ctfe
but I never seem to get it working.
I always get "variable x cannot be read at compile time" in this method :

auto bitsetToRange(in SudokuCell x) {
    return boardSide.iota().filter!(i => (x >> i) & 1)().map!(x=>x+1)();
}

with SudokuCell beeing declared as:
alias ushort SudokuCell;

I want to generate a dynamic array with all return values form this
method with x ranging from 0..sudokuCell.size.
Why is it complaining x cannot be read at compile time while it is
passed at compile time?


More information about the Digitalmars-d-learn mailing list