Splitting Ranges using Lambda Predicates
"Nordlöw" via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Oct 9 14:55:01 PDT 2014
On Wednesday, 11 June 2014 at 08:58:58 UTC, monarch_dodra wrote:
> auto slicer(alias isTerminator, Range)(Range input)
> if (((isRandomAccessRange!Range && hasSlicing!Range) ||
> isSomeString!Range)
> && is(typeof(unaryFun!isTerminator(input.front))))
> {
> return SlicerResult!(unaryFun!isTerminator, Range)(input);
> }
> ...
Your solution copied here
https://github.com/nordlow/justd/blob/master/slicer.d
errors as
/home/per/opt/x86_64-unknown-linux-gnu/dmd/linux/bin64/src/phobos/std/algorithm.d(5752,24):
Error: template std.functional.not!(isUpper).not cannot deduce
function from argument types !()(dchar), candidates are:
/home/per/opt/x86_64-unknown-linux-gnu/dmd/linux/bin64/src/phobos/std/functional.d(393,10):
std.functional.not!(isUpper).not(T...)(T args) if
(is(typeof(!unaryFun!pred(args))) ||
is(typeof(!binaryFun!pred(args))))
slicer.d(29,31): Error: template instance
std.algorithm.find!(not, string) error instantiating
slicer.d(16,12): instantiated from here: Slicer!(isUpper,
string)
slicer.d(85,30): instantiated from here: slicer!(isUpper,
string)
What's wrong?
More information about the Digitalmars-d-learn
mailing list