On 02/19/2012 12:40 AM, Andrej Mitrovic wrote:
On 2/19/12, Andrej Mitrovic<[email protected]> wrote:Chunk[] tempVar = chunks.get("CCCC", null) ~ new Chunk();I've tried making a wrapper type that does this behind the scenes but it won't work: struct Hash(Key, Val) { Val[Key] aa; Val opIndex(Key key) { return aa.get(key, Val.init); } alias aa this; } class Chunk { } alias Hash!(string, Chunk) ChunkHash; void main() { ChunkHash chunks; Chunk[] tempVar = chunks["CCCC"] ~ new Chunk(); } test.d(20): Error: incompatible types for ((chunks.opIndex("CCCC")) ~ (new Chunk)): 'test.Chunk' and 'test.Chunk' Very odd..
The error is unrelated to your wrapper type. static assert(!is(typeof(1~1))); Concatenation only works if at least one of the types is an array.
