On Saturday, 1 October 2016 at 17:55:08 UTC, Uranuz wrote:
On Saturday, 1 October 2016 at 17:32:59 UTC, Uranuz wrote:
On Saturday, 1 October 2016 at 17:23:16 UTC, Uranuz wrote:
[...]

But these example fails. Oops. Looks like a bug(

import std.stdio;
import std.algorithm;
import std.range;
import std.string;

[...]

I created bug report on this:
https://issues.dlang.org/show_bug.cgi?id=16569

This isn't a bug. It's illegal to access the front or back of an empty range. (If anything is a bug, it's the nondescriptiveness of the error.) You should write this instead:

void main()
{
    string str = "";
    auto split = str.splitter('.');
    if(!split.empty) writeln(split.back);
}

Reply via email to