On 11/28/10 1:09 PM, Peter Alexander wrote:
On 28/11/10 4:37 PM, Andrei Alexandrescu wrote:
The library solution to logical constness would gravitate around a union
with a const (or immutable) and a regular field of the same type:

union {
T before;
const T after;
}


Andrei

I must be missing something. Surely, when inside a const method, you
still can't modify a union, whether you access a const member of the
union or not?

Could you elaborate?

Sorry, that was wrong. I was thinking of a lazily initialized field within an otherwise non-const object.

Andrei

Reply via email to