splitter string/char different behavior

Jonathan M Davis newsgroup.d at jmdavisprog.com
Sun Oct 1 01:04:39 UTC 2017


On Sunday, October 01, 2017 00:56:23 SrMordred via Digitalmars-d-learn 
wrote:
> > In order to know where to split, it really has to do it from
> > the front. If it starts from the back, you won't necessarily
> > split in the same places as when iterating from the front, and
> > that would violate how bidirectional ranges are supposed to
> > work (the elements should be the same - just in reverse - if
> > you iterate from the back). That being the case, it makes sense
> > that splitting on a single element would result in a range that
> > was bidirectional, whereas splitting on a range of elements
> > would result in a range that's only a forward range.
> >
> > - Jonathan M Davis
>
> Nice!
> since dropBack is a BidirectionalRange everything make sense now.
> Thanks everybody!
>
> I just think that the error message should be a little better,
> since I have no idea about the incompatible Range types looking
> only to the error message. (Dont know if is possible, but
> anyway.. )

When the compiler can't find a matching overload for a templated function,
look at its template constraint, since you either passed the wrong number of
arguments, the wrong type of arguments, or the arguments you passed failed
the template constraint. The template constraints aren't always as easy to
read as would be nice (especially if there are several overloads), but the
key information is there.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list