splitter string/char different behavior

SrMordred patric.dexheimer at gmail.com
Sat Sep 30 19:26:14 UTC 2017


>> For "a.b.c"splitter(x), Range r is a string, r.front is a 
>> char. The template can only be instantiated if the predicate 
>> function is valid. The predicate function is "a == b". Since 
>> r.front is a char, then s must be a type that can be compared 
>> with '=='. A string and char cannot be compared with '==', 
>> which is why the a valid template instantiation could not be 
>> found.
>
> Would it be correct to just update the documentation to say 
> "Lazily splits a range using an char as a separator" ?   what 
> is it; wchar and dchar too?
>
> I notice the example that is there has ' '  as the element.

But this works:
writeln("a.b.c".splitter(".") );


More information about the Digitalmars-d-learn mailing list