On 3/16/21 1:58 AM, David Skluzacek wrote:
>
> Error: template std.algorithm.iteration.splitter cannot deduce function from argument types !()(GZippedFile, string), candidates are: > /usr/include/dlang/dmd/std/algorithm/iteration.d(4678): splitter(alias pred = "a == b", Range, Separator)(Range r, Separator s)
>    with pred = "a == b",
>         Range = GZippedFile,
>         Separator = string
>    must satisfy the following constraint:
>         is(typeof(binaryFun!pred(r.front, s)) : bool)

That means that you should be able to call your predicate ("a == b") with GZippedFile.front and separator as arguments (they are dchar and string respectively)

> (...)
>
> If I change the newline separator to a character literal, I get:
>
> (...)
> /usr/include/dlang/dmd/std/algorithm/iteration.d(5055): splitter(alias pred = "a == b", Range, Separator)(Range r, Separator s)
>    with pred = "a == b",
>         Range = GZippedFile,
>         Separator = char
>    must satisfy the following constraint:
>         is(typeof(binaryFun!pred(r.front, s.front)) : bool)
>
> It seems like "\n" should pass the second constraint and '\n' should pass the first. Using a dchar or dstring makes no difference. Adding @property to front makes no difference. Is this a bug?
>

Also there are other constraints (see https://run.dlang.io/is/rcSJJf)
like:
/dlang/ldc-1.25.1/bin/../import/std/algorithm/iteration.d(5055): splitter(alias pred = "a == b", Range, Separator)(Range r, Separator s)
  with pred = "a == b",
       Range = GZippedFile,
       Separator = string
  must satisfy one of the following constraints:
       hasSlicing!Range
       isNarrowString!Range

That means that you GZippedRange should provide opSlice operator and should be a narrow string (string of char or wchar)

Reply via email to