Dfr:

Here is few code eaxamples, i don't know why it is doesn't work as expected.

Here i want to transform string into list of tuples split by character:

auto nameparts = splitter("go.home", '.').map!(v => tuple(v,0)).array;

This gives me not very useful message about assert and stuff:
core.exception.AssertError@std.algorithm(1942): Assertion failure

It works for me:


void main() {
    import std.stdio, std.algorithm, std.typecons, std.range;

    auto nameParts = "go.home"
                     .splitter('.')
                     .map!(v => tuple(v, 0))
                     .array;

    nameParts.writeln;
}


Output:

[Tuple!(string, int)("go", 0), Tuple!(string, int)("home", 0)]

I am using dmd 2.065alpha on Windows.

Bye,
bearophile

Reply via email to