On Friday, 3 October 2014 at 20:15:33 UTC, Nordlöw wrote:
Note that I had to tweak empty() a bit. I don't know if I got right. Could you check?

Sounds about right, but I didn't really look.

Further I can't get string support to work:

    writefln("%(%s\n%)", slidingSplitter("Nordlöw"));

errors as

std.format.FormatException@/home/per/opt/x86_64-unknown-linux-gnu/dmd/linux/bin64/src/phobos/std/format.d(2591): Expected '%s' format specifier for type 'SlidingSplitter!string'

and

    foreach (e; name)
    {
        version(show) writeln(e);
    }

errors as

range_ex.d(132,5): Error: invalid foreach aggregate name, define opApply(), range primitives, or use .tupleof

which diagnostics I btw is responsible for :)

Could you please check?

Sounds like your range isn't a range. Did you check that:
isInputRange!(SlidingSplitter!string)
?

As mentioned in the first reply, it's a very important check, as it's very easy to get wrong.

For example, if you forget to mark front and empty as properties, then you don't have the correct range interface I believe.

On Friday, 3 October 2014 at 17:46:18 UTC, monarch_dodra wrote:
       writefln("%(%s\n%)", slidingSplitter("Nordlöw"));

That's a really cool syntax, btw. I got to remember that.

Yup. Love it. Use it.

Reply via email to