std.stream example
Simen Kjaeraas
simen.kjaras at gmail.com
Mon Apr 28 06:45:02 PDT 2008
On Mon, 28 Apr 2008 15:36:18 +0200, Me Here <p9e883002 at sneakemail.com>
wrote:
>
> I just tried to compile the following example ffrom the std.stream docs:
>
> import std.stdio;
> import std.stream;
>
> int main (char[][] args) {
> Stream file = new BufferedFile( "myfile" );
> foreach( ulong n, string line; file ) {
> writefln( "line %d: %s", n,line );
> }
> file.close();
> return 0;
> }
>
> I'm getting:
>
>
> fhash.d(31): function std.stream.Stream.opApply (int delegate(ref char[]
> line))
> does not match parameter types (int delegate(ref ulong __applyArg0, ref
> invariant(char)[] __applyArg1))
>
> fhash.d(31): Error: cannot implicitly convert expression
> (__foreachbody15)
> of type int delegate(ref ulong __applyArg0, ref invariant(char)[]
> __applyArg1)
> to int delegate(ref ulong n, ref wchar[] line)
>
> Have I got my libraries screwed up?
> Or c&p the example incorrectly?
> Or is the example just out of date or otherwise screwed?
>
> Cheers, b.
Looks like a bug to me. Compiles under 1.029, not under 2.0xx.
-- Simen
More information about the Digitalmars-d
mailing list