QtD is suspended
Steven Schveighoffer
schveiguy at yahoo.com
Fri Sep 17 10:04:08 PDT 2010
On Fri, 17 Sep 2010 12:44:30 -0400, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> On 9/17/10 10:48 CDT, Michel Fortin wrote:
>> I understand the intent quite well. I'm talking about what happens if
>> the source is const?
>
> The whole point is, mutation is the motivator. If you copy an empty
> hash, no problem because the receiver can't mutate it.
yeah, but he can read it:
struct S
{
int[int] hash;
const(int[int]) getHash() const { return hash; }
}
void main()
{
S s;
auto h = s.getHash();
s.hash[1] = 1;
assert(1 in h); // fails
}
-Steve
More information about the Digitalmars-d-announce
mailing list