const

Janice Caron caron800 at googlemail.com
Sun Apr 27 12:50:17 PDT 2008


On 27/04/2008, Bruno Medeiros <brunodomedeiros+spam at com.gmail> wrote:
>  It's impossible? How about:
>   const int x = someFuncThatReturnsConst();

x is still immutable.


>  Your statement is only true if the said variable is static AND has an
> initializer.
>  (also, to be more accurate, the type in the example should be changed to
> something other than a basic type like int)

Since the publication of accu-functional.pdf, we're all out of date
here. Let's get back up to speed.

Any type which contains no pointers to mutable data is implicitly
castable to invariant.

That's what I meant, but Andrei said it better! :-)



More information about the Digitalmars-d mailing list