opAssign and const?
Steven Schveighoffer
schveiguy at yahoo.com
Fri May 4 05:42:53 PDT 2012
On Fri, 04 May 2012 02:52:49 -0400, Era Scarecrow <rtcvb32 at yahoo.com>
wrote:
> On Friday, 4 May 2012 at 06:48:40 UTC, Jonathan M Davis wrote:
>> If you make the one which isn't a ref const as well, it'll probably
>> work.
>
> Yeah I think so too. It will just be either a direct copy or I cast
> the object as const and pass it through. Seems like extra work to me and
> should be handled by the compiler. Anyways, thanks for looking at the
> problem with me.
I don't think it will make a copy of a temporary even if it's cast to
const. I think marking the non-ref version as const will solve the
problem how you wish (as long as the argument really *isn't* modified
inside that function).
-Steve
More information about the Digitalmars-d-learn
mailing list