inout method is not callable using a const object

Jonathan Crapuchettes jcrapuchettes at gmail.com
Fri Sep 6 13:14:19 PDT 2013


Can someone help me understand how to correct this error?

Error: inout method ...ValidSparseDataStore.opIndex is not callable using 
a const object

The specific method is defined as:

struct ValidSparseDataStore
{
    inout(DataT*) opIndex(const Address addr) inout
    {
        if (auto node = findNode(addr))
            return cast(inout)&(node.data);

        return null;
    }

    private ValidSparseNode* findNode(const Address ids) const
    {
        ...
    }
}

Thank you,
JC


More information about the Digitalmars-d-learn mailing list