Fully transitive const is not necessary
Walter Bright
newshound1 at digitalmars.com
Thu Apr 3 11:37:00 PDT 2008
Sean Kelly wrote:
>> Essentially, const in C++ only works for
>> trivial objects. (I'm not saying trivial objects are not useful, I'm
>> just saying they are trivial.)
>
> I think this statement is open to interpretation. From a theoretical perspective
> I agree. But with RAII objects managing references and the like, it's rare for
> even very complex objects to contain raw pointers, and such RAII objects can
> be made to fake transitivity of const by overloading their const and non-const
> methods appropriately.
For a new design, we shouldn't have to fake it. And faking it is
complicated, which means that realistically, it isn't going to get done.
People will just rely on convention.
More information about the Digitalmars-d
mailing list