
28 Sep
2006
28 Sep
'06
6:55 p.m.
"Eric Niebler" <eric@boost-consulting.com> writes:
Also an interesting question is how to get the type system to enforce the immutability of a type. If there is a type which is inherently immutable (because it is empty, for instance), we have two options:
I guess I don't get what you're trying to accomplish here. If it's inherently immutable, the compiler is enforcing immutability no matter what you do. IOW, there's no available interface through which you can mutate instances. That's just what adding const to a well-behaved mutable type does: makes all mutating operations unavailable. What am I missing? -- Dave Abrahams Boost Consulting www.boost-consulting.com