Re: Baffled by compilation error for formattedRead

2015-05-07 Thread PhilipDaniels via Digitalmars-d-learn
On Thursday, 7 May 2015 at 23:23:08 UTC, Justin Whear wrote: formattedRead takes its input by ref and consumes it. Your first two attempts are both passing the result of functions (dropExactly and opSlice) which are temporary rvalues and can thus not be passed by reference. Here's more

Re: Baffled by compilation error for formattedRead

2015-05-07 Thread Dennis Ritchie via Digitalmars-d-learn
On Thursday, 7 May 2015 at 23:13:41 UTC, PhilipDaniels wrote: On Thursday, 7 May 2015 at 23:10:26 UTC, PhilipDaniels wrote: Let's try reformatting that... ubyte r, g, b; // does not compile auto numRead = formattedRead(dropExactly(input, 4), %x/%x/%x, r, g, b); // does not compile auto

Re: Baffled by compilation error for formattedRead

2015-05-07 Thread Justin Whear via Digitalmars-d-learn
On Thu, 07 May 2015 23:10:26 +, PhilipDaniels wrote: Why do the first two fail to compile but the last one does?! I cannot see any difference between the 's2' case and the second case, it is a completely mechanical source code transformation I have made. formattedRead takes its input by

Re: Baffled by compilation error for formattedRead

2015-05-07 Thread PhilipDaniels via Digitalmars-d-learn
On Thursday, 7 May 2015 at 23:10:26 UTC, PhilipDaniels wrote: Let's try reformatting that... ubyte r, g, b; // does not compile auto numRead = formattedRead(dropExactly(input, 4), %x/%x/%x, r, g, b); // does not compile auto numRead = formattedRead(input[4..$], %x/%x/%x, r, g, b); //

Baffled by compilation error for formattedRead

2015-05-07 Thread PhilipDaniels via Digitalmars-d-learn
Given a string string input = rgb:20/30/40; And the following: ubyte r, g, b; auto numRead = formattedRead(dropExactly(input, 4), %x/%x/%x, r, g, b); // does not compile auto numRead = formattedRead(input[4..$], %x/%x/%x, r, g, b);// does not compile