Error using `equal` with various string types
Jonathan M Davis
jmdavisProg at gmx.com
Sat Feb 23 19:50:52 PST 2013
On Sunday, February 24, 2013 04:39:55 Andrej Mitrovic wrote:
> It seems this doesn't work:
>
> import std.algorithm;
> auto b1 = qual(["foo"d], ["foo"]);
> auto b2 = equal(["foo"d.dup], ["foo"]);
>
> It's due to a constraint failure:
> is(typeof(r1.front == r2.front))
>
> The first call is:
> immutable(dchar)[]
> string
>
> The second:
> dchar[]
> string
>
> Anyway can we make `equal` work with these? It would be really useful
> if it worked.
Well, if r1.front and r2.front can't be compared, what do you expect? You're
trying to compare an array of dstrings and an array of strings. strings and
dstrings aren't comparable. What you need is some sort of recursive equals.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list