Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2006-09-28 15:15:27

David Abrahams wrote:
> "Eric Niebler" <eric_at_[hidden]> 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?

Terminology issue? I mean, if there is a type X, and we want "x = y" to
fail to compile for objects x,y of type X, what is the best way to
accomplish that?

1) X is actually a typedef for a const-qualified type detail::X_impl
2) X has a private copy-assign operator

I then pointed out that neither of these are appropriate for keyword<>.

Eric Niebler
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at