On 8/30/2010 12:22 AM, Paul Rubin wrote:
I guess that is how the so-called smart pointers in the Boost C++ template library work. I haven't used them so I don't have personal experience with how convenient or reliable they are, or what kinds of constraints they imposed on programming style. I've always felt a bit suspicious of them though, and I seem to remember Alex Martelli (I hope he shows up here again someday) advising against using them.
"Smart pointers" in C++ have never quite worked right. They almost work. But there always seems to be something that needs access to a raw C pointer, which breaks the abstraction. The mold keeps creeping through the wallpaper. Also, since they are a bolt-on at the macro level in C++, reference count updates aren't optimized and hoisted out of loops. (They aren't in CPython either, but there have been reference counted systems that optimize out most reference count updates.) John Nagle -- http://mail.python.org/mailman/listinfo/python-list