
Hi, I've got several questions about the former version of boost::shared_ptr. Would someone please help me? 1. Mr Stroustrup said that there wasn't a need for auto_array, for "a better solution is to use a vector". So, should we use vector or scoped_array/shared_array? 2. In the document, four implementations are said to have been discussed: Direct detached, Indirect detached, Embedded detached and Placement detached. I've tried to describle them (Are I right? See the attached file), but I don't understand the Placement detached. Could someone please tell me what it's like? 3. In the file smart_ptr.hpp, we can see the private function shared_ptr::share. void share(T* rpx, long* rpn) { if (pn != rpn) { ++*rpn; // done before dispose() in case rpn transitively // dependent on *this (bug reported by Ken Johnson) dispose(); px = rpx; pn = rpn; } } // share I'm sorry that I don't understand that reason why ++*rpn should be done before dispose(). Would someone please give me an example? Or is it like this? #include <boost/smart_ptr.hpp> struct A { boost::shared_ptr<A> v; }; int main() { A* pa = new A; boost::shared_ptr<A> ptr(pa); ptr = pa->v; } 4. Why not use policies? I'm afraid that the word "parameterization will discourage users" might not be always true, for we can use default parameters. Jon Wang 2002-01-31