[Xorp-hackers] Boost use
greearb at candelatech.com
Mon Apr 26 11:37:59 PDT 2010
On 04/26/2010 02:28 AM, Bruce Simpson wrote:
> Nothing like a good healthy rigorous technical debate on a caffeinated
> Monday morning.
> On 04/26/10 04:45, Ben Greear wrote:
>> The ref-pointer logic might could be done better, but I don't think we
>> to include boost to do that. We could, for instance, use a 'RefCountable'
>> base class that stores a ref count, and a RefPointer objec that stores
>> a pointer
>> to RefCountable and manages the object lifetime. In general, I think we
>> should minimize ref-pointer usage where possible, but in some places,
>> it is quite useful.
> Thoroughly disagree,
> the above is more or less suggesting reinventing the Boost smart_ptr
> Why reinvent when you can reuse?
By the way, I just tried to understand that boost smart_ptr and weak_ptr
by looking at the boost code. I personally find it basically unreadable,
but I have never been too good at templates.
If I make an attempt at re-doing the smart-ptr logic, I think I'll
use inheritance instead of templates, as I find that type of code
much easier to understand. It's not as general purpose, since your ref-counted
objects must inherit from a common base class, but since I think ref-pointers
should be used sparingly anyway, that shouldn't be a problem.
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc http://www.candelatech.com
More information about the Xorp-hackers