std.array.array extended example to supplement that in std.array

2010-02-07 Thread Steve Teale
import std.array; import std.range; import std.stdio; // A contrived input range struct Sir { string s; int pos; bool empty() { return pos = s.length; } void popFront() { pos++; } int front() { return s[pos]-'0'; } } int[] da = [1,2,3,4,5]; int[5] sa = [1,2,3,4,5]; void

Template instantiation without (...)

2010-02-07 Thread Steve Teale
Which bit of the spec for template instantiation is it that allows the last two lines of the following to compile and work? import std.stdio; struct A { int a; } template Thingie(T) { static if (is(T == int)) enum Thingie = 1; else enum Thingie = 0; } void main()

Re: Template instantiation without (...)

2010-02-07 Thread Daniel Murphy
Steve Teale Wrote: Which bit of the spec for template instantiation is it that allows the last two lines of the following to compile and work? import std.stdio; struct A { int a; } template Thingie(T) { static if (is(T == int)) enum Thingie = 1; else

Re: Template instantiation without (...)

2010-02-07 Thread Steve Teale
I suppose it's the part of the spec you're about to write a patch for. I guess so. It was discussed on one of the forums back in October 2008. I guess it got implemented but never made the documentation.

Re: Template instantiation without (...)

2010-02-07 Thread Steve Teale
I suppose it's the part of the spec you're about to write a patch for. Twas at: http://www.digitalmars.com/d/archives/digitalmars/D/ Template_instantiation_syntax_77507.html#N77507

Re: interpret.c assertion failure on enum.stringof mixin

2010-02-07 Thread strtr
strtr Wrote: strtr Wrote: enum { E }; void _mixin() { writefln( E.stringof ); } void func() { mixin(_mixin); } Assertion failure: '!dim || (parameters (parameters-dim == dim))' on line 140 in file 'interpret.c' At least I got a line number this time :) Had