PhobosWatch: manifest => enum
Steven Schveighoffer
schveiguy at yahoo.com
Fri Dec 28 12:11:53 PST 2007
"Janice Caron" wrote
> On 12/28/07, Walter Bright <newshound1 at digitalmars.com> wrote:
>> Janice Caron wrote:
>> > y is a /copy/ of x, and clearly it should be possible to make a copy
>> > of a const thing and have the copy be mutable.
>>
>> That doesn't work for structs or classes.
>
> It doesn't? For structs
>
> struct S {}
> const S x;
> auto y = x;
What about:
struct S { char[] str};
const S x = S("hello".dup);
auto y = x;
If y is not const, then y.str is not const, yet it points to the same data
as x.
-Steve
More information about the Digitalmars-d
mailing list