On Tuesday, 25 October 2016 at 17:19:26 UTC, Jacob Carlborg wrote:

Very impressive :)

Thanks.

I just got the following code to compile and execute correctly.

bool strEq(string a, string b)
{
    if (a.length != b.length)
    {
        return false;
    }
    uint length = cast(uint) a.length;

    while(length--)
    {
        auto c1 = a[length];
        auto c2 = b[length];
        if (c1 != c2)
        {
            return false;
        }
    }

    return true;
}

static assert(!strEq("Hello","World"));
static assert(strEq("World","World"));

I used the generated bytecode to make == for strings work.

Reply via email to