On 04/26/2010 02:28 AM, Bruce Simpson wrote: > Hi, > > 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 >> need >> 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 > library. > > 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. Thanks, Ben -- Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com _______________________________________________ Xorp-hackers mailing list [email protected] http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers
