Safer casts

Janice Caron caron800 at googlemail.com
Sun May 11 06:44:07 PDT 2008


On 11/05/2008, Yigal Chripun <yigal100 at gmail.com> wrote:
> another option would be to allow:
>  cast(const(T))x;
>  where you redefine the constancy of x and this would be subject to a
>  test that T is not a different type (except for constancy, of course).

Oh, I see. So, cast(T) would double up for /either/ downcasting, /or/
removing constancy, but never both at the same time. (Both at the same
time would require two casts).

This is probably the best suggestion of all. I like it.



More information about the Digitalmars-d mailing list