string types: const(char)[] and cstring
Walter Bright
newshound1 at digitalmars.com
Fri May 25 21:34:41 PDT 2007
Daniel Keep wrote:
> One question though: are the parens necessary? I was under the
> impression that const and invariant applied to reference types, so it
> would be const char[] or const(char[]), since char by itself is just a
> value type.
const(char)[] => array of const characters
const char[] => const array of const characters
const(char[]) => const array of const characters
Think of const as if it were a template:
Const!(T)
which returns a const version of its argument.
const without any parens means it applies to the whole type.
More information about the Digitalmars-d-announce
mailing list