Inherited const when you need to mutate
deadalnix
deadalnix at gmail.com
Wed Jul 11 07:00:03 PDT 2012
On 10/07/2012 22:11, Jonathan M Davis wrote:
> On Tuesday, July 10, 2012 12:00:59 H. S. Teoh wrote:
>> I think hidden somewhere in this is an unconscious conflation of
>> physical const with logical const.
>
> I completely disagree at least as far as classes go. opEquals, opCmp,
> toString, and toHash must be _physically_ const, because they must work with
> physically const objects. There is _no_ way around that, and whether the
> actual internals of those functions could conceivably mutate something if they
> were logically const is irrelevant.
That is pretty clear and I couldn't agree more.
More information about the Digitalmars-d
mailing list