I have code like this in dcollections:

    /**
* Removes the element that has the given key. Sets wasRemoved to true if the
     * element was present and was removed.
     *
     * Runs on average in O(1) time.
     */
    HashMap remove(K key, out bool wasRemoved)
    {
        cursor it = elemAt(key);
        if(wasRemoved = !it.empty)
        {
            remove(it);
        }
        return this;
    }


However, this does not compile with the following message:

dcollections/HashMap.d(561): Error: '=' does not give a boolean result

line 561 is the if statement.

Since when did bool = bool not give a bool result?

Do I have to write it out like this:

if((wasRemoved = !it.empty) == true)

I can understand for ints and strings and whatnot, but for booleans?

-Steve

Reply via email to