Trying to search a range

Kevin Bailey keraba at yahoo.com
Sat Jul 3 00:29:23 UTC 2021


Sorry if this is too simple of a question, but I'm trying to 
simply find
a blank line in a file. I'm doing something like:

```
auto file = File("somefile");
auto r = file.byLine();
auto tup = r.findSplit("");
// tup[0] would contain the range before the line,
// tup[2] would contain the range after, not unlike findSplit
```

Unfortunately, ldc2 is saying:

```
split.d(8): Error: template std.algorithm.searching.findSplit 
cannot deduce function from argument types !()(ByLineImpl!(char, 
char), string), candidates are:
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/algorithm/searching.d(2882):        findSplit(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle)
   with pred = "a == b",
        R1 = ByLineImpl!(char, char),
        R2 = string
   must satisfy the following constraint:
        isForwardRange!R1
```

I can't tell if findSplit() only works on strings, or if maybe I'm
trying to compare different types of strings, or if I'm overtaxing
the type deduction system.




More information about the Digitalmars-d-learn mailing list