Cannot overload on constness of a struct

Janice Caron caron800 at googlemail.com
Wed Nov 7 01:18:57 PST 2007


struct A(uint N)
{
    private ubyte[N] data;

    ubyte * ptr() { return &data[0]; }
    const const(ubyte) * ptr() { return &data[0]; }
}

Error: function ptr conflicts with function ptr


If A is mutable, then ptr should return a pointer to ubyte.
If A is const, then ptr should return a pointer to const ubyte.

Please tell me this will work after the revamp of const?



More information about the Digitalmars-d mailing list