Possible way to achieve lazy loading with const objects

Steven Schveighoffer schveiguy at yahoo.com
Fri Sep 30 08:17:06 PDT 2011


On Fri, 30 Sep 2011 10:53:50 -0400, Christophe  
<travert at phare.normalesup.org> wrote:

>> What I think we need is to make the free function opEquals a template,
>> which only instantiates for objects, and then the lhs.opEquals(rhs) and
>> rhs.opEquals(lhs) will take full advantage of any overloaded opEquals.
>>
>> For example, if you wanted to overload for non-const objects.  But I  
>> think
>> the default in Object should be const.
>
> Thanks for the explanation.
> That seems to be a nice solution to me.
> (some people might complain of template bloat...)

I actually just tested this and it works (no compiler changes necessary).

I'll start a new thread to discuss.

-Steve


More information about the Digitalmars-d mailing list