Boost logo

Boost :

Subject: Re: [boost] [intrusive_ptr] Why are comparison operators not friends?
From: Carsten Fuchs (carsten.fuchs_at_[hidden])
Date: 2012-08-10 04:25:53


Hi Christopher,

Am 2012-08-09 12:47, schrieb Hite, Christopher:
>> I was just (re-)reading item 46, "Define non-member functions inside templates when type conversions are desired", in Scott Meyers "Effective C++, 3rd edition", and was wondering how and why the comparison operators for intrusive_ptr work when used with NULL, even though they're > not friend functions as described in Scott Meyer's item 46.
> I believe you're talking about the ancient technique of friend injection used here for example:
> http://en.wikipedia.org/wiki/Barton%E2%80%93Nackman_trick
>
> The modern good way of doing this Koenig lookup which I think deprecates that trick.
> http://en.wikipedia.org/wiki/Argument-dependent_name_lookup

Thank you very much for your reply!

I still have to experiment and compare and check my code, but the linked articles and
their references help a lot!
Thanks!

Best regards,
Carsten

-- 
    Cafu - the open-source Game and Graphics Engine
for multiplayer, cross-platform, real-time 3D Action
           Learn more at http://www.cafu.de

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk