splitter string/char different behavior

Jon Degenhardt jond at noreply.com
Sat Sep 30 19:40:01 UTC 2017


On Saturday, 30 September 2017 at 19:26:14 UTC, SrMordred wrote:
>>> 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(".") );

Geez, my mistake. I'm sorry about that. It's dropback that's 
failing, not splitter.


More information about the Digitalmars-d-learn mailing list