Re: reference of boost::shared_ptr instead of Handle

Posted by Andrew Kolesnikov on
URL: http://quantlib.414.s1.nabble.com/reference-of-boost-shared-ptr-instead-of-Handle-tp7623p7651.html

Luigi, just to clarify this fundamental issue, look at follow constructor.

    template <class T>
    inline Handle<T>::Handle(T* ptr_h,
                             bool registerAsObserver)
    : link_(new Link(boost::shared_ptr<T> (ptr_h),registerAsObserver)) {}

Is it possible to add such constructor in new QL version, cause i guess it's more easy-to-use (and i use it
successfully)? Pay attention, that this declaration doesn't run counter to purpose of handles, moreover it won't create problem with allocation of T* pointer.

Luigi Ballabio wrote
With Handles instead, when you relink the handle the Foo instance sees
the new T object.

Luigi