Invariant Question (yes, another one)

Janice Caron caron800 at googlemail.com
Thu Nov 15 07:17:25 PST 2007


On 11/15/07, Steven Schveighoffer <schveiguy at yahoo.com> wrote:
> Your first data type is an AA with invariant strings as keys and values.
> HOWEVER, the AA itself is not invariant.  Suppose after you converted to an
> AA with const strings as keys and values, you replaced one of the values
> with a mutable string cast into a const string.

Yes, you're right.

invariant(char)[][] won't implicitly convert to const(char)[][]
either, for the same reason.
But...
invariant(char[])[] will implicitly conver to const(char[])[]

But here's the odd thing...

invariant(char[])[] will implicitly conver to const(char[])[]
but
invariant(char[])[int] won't implicitly convert to const(char[])[int]

The only difference is the int in the square brackets.



More information about the Digitalmars-d mailing list