On Saturday, 24 December 2016 at 00:55:01 UTC, Yuxuan Shui wrote:
I tried this:
immutable int[char] xx = ['Q':0, 'B':1, 'N':2, 'R':3,
'P':4];
And got a "non-constant expression" error (with or without
'immutable').
What's the correct way?
This works:
void main() {
immutable
On Saturday, 24 December 2016 at 11:21:11 UTC, Stefan Koch wrote:
On Saturday, 24 December 2016 at 00:55:01 UTC, Yuxuan Shui
wrote:
What's the correct way?
You cannot initialize an AA at compile-time.
Because AA's are provided by druntime and the ABI is not stable.
For fun I'm throwing
On Saturday, 24 December 2016 at 11:21:11 UTC, Stefan Koch wrote:
You cannot initialize an AA at compile-time.
Because AA's are provided by druntime and the ABI is not stable.
This bit me when I was first starting out as well. I feel like
there's really very little documentation on this, and
On Saturday, 24 December 2016 at 00:55:01 UTC, Yuxuan Shui wrote:
I tried this:
immutable int[char] xx = ['Q':0, 'B':1, 'N':2, 'R':3,
'P':4];
And got a "non-constant expression" error (with or without
'immutable').
What's the correct way?
You cannot initialize an AA at compile-time.
On Saturday, 24 December 2016 at 00:57:04 UTC, Yuxuan Shui wrote:
On Saturday, 24 December 2016 at 00:55:01 UTC, Yuxuan Shui
wrote:
I tried this:
immutable int[char] xx = ['Q':0, 'B':1, 'N':2, 'R':3,
'P':4];
And got a "non-constant expression" error (with or without
'immutable').
I tried this:
immutable int[char] xx = ['Q':0, 'B':1, 'N':2, 'R':3, 'P':4];
And got a "non-constant expression" error (with or without
'immutable').
What's the correct way?