const challenge
Kris
foo at bar.com
Fri Feb 1 13:18:31 PST 2008
Sergey Gromov Wrote:
>
> 'const' and 'in' work exactly the same, just checked.
>
> void foo(in char[] s) { writeln(s); }
> void bar(const char[] s) { writeln(s); }
>
> foo("test");
> foo("test"[0..2]);
> foo("test".dup);
> bar("test");
> bar("test"[0..2]);
> bar("test".dup);
>
> compiles and works correctly.
>
> SnakE
Thank you, SnakE, for clarifying that. I'd been harbouring a misguided impression that invariant would not implicitly cast to const
More information about the Digitalmars-d
mailing list