Re: static array is no range?

2015-09-05 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Sunday, 6 September 2015 at 00:25:10 UTC, cym13 wrote: Yes, static arrays aren't ranges. The main reason is that static arrays are value type (ie: you copy them arround when passing them to functions which usually has a huge cost) where ranges are reference type (no copy, lighter, not always

Re: static array is no range?

2015-09-05 Thread cym13 via Digitalmars-d-learn
On Saturday, 5 September 2015 at 11:12:17 UTC, Sebastiaan Koppe wrote: ``` import std.algorithm; char[1024] buffer; buffer.find("LOCATION: "); // get error about how all the different versions of find don't match ``` ``` import std.algorithm; char[1024] buffer; buffer[0..$].find("LOCATION: ");

static array is no range?

2015-09-05 Thread Sebastiaan Koppe via Digitalmars-d-learn
``` import std.algorithm; char[1024] buffer; buffer.find("LOCATION: "); // get error about how all the different versions of find don't match ``` ``` import std.algorithm; char[1024] buffer; buffer[0..$].find("LOCATION: "); // works as expected ``` Before trying the slice I manually pragma(msg