"Peter Dimov" <[EMAIL PROTECTED]> writes: > From: "David Abrahams" <[EMAIL PROTECTED]> > >> I could use something like a std::map< weak_ptr<>, PyObject* >, ... > > Yes, that's the "canonical" solution if you need to associate arbitrary data > with objects managed by shared_ptrs.
In my case it's not arbitrary. It's /exactly/ the data which is used to initialize the shared_ptr<>. Having to back through a map seems somehow... perverse to me. >> ... but that would be truly awful: >> >> 1. I would need to sweep the map of dead entries periodically >> 2. It would incur a great deal of overhead >> 3. It would be very complicated. > > I agree with (1), but (2) & (3) don't look obvious to me. > > Please think about this solution for a while to see whether it stays > "truly awful". :-) I first considered that approach shortly after Boost.Python v1 came out, back in... well, it was several years ago. It's never been a price I was willing to force on users. The picture hasn't changed much, except that now I know I'm going to make deleters which hold exactly the data I want. I think I'd probably hack up a specialized shared_ptr<APrivateClass> so that I could take advantage of the friend declarations in the implementation before I'd use a map-based solution. I realize my case is somewhat unusual. I can't really argue that it warrants publicizing deleter introspection for everybody... however, since we're all part of a big happy Boost family and I /could/ always switch to a map if the shared_ptr implementation changes, how bad would it be for me to use my hack? -- David Abrahams [EMAIL PROTECTED] * http://www.boost-consulting.com Boost support, enhancements, training, and commercial distribution _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost