Type info
Title comphelper::make_shared_from_UNO()
Posted by [EMAIL PROTECTED]
Affected ...,
Effective from cws presfixes08


Summary

comphelper/make_shared_from_uno.hxx, namespace comphelper:

+ template <typename T>
+ inline ::boost::shared_ptr<T> make_shared_from_UNO( T * p );

Inspired by http://www.boost.org/libs/smart_ptr/sp_techniques.html#com


Description
/** Makes a boost::shared_ptr from a ref-counted UNO object pointer.
This makes sense if the object is used via UNO (implementing some X
interface) and also internally using its implementation class, e.g.

<pre>
boost::shared_ptr<MyUnoImpl> const ptr(
comphelper::make_shared_from_UNO( new MyUnoImpl ) );
...
xUno->callingUno( uno::Reference<XSomeInterface>( ptr.get() ) );
...
takeSharedPtr( ptr );
...
</pre>

@attention The shared_ptr operates on a separate reference counter, so
weak pointers (boost::weak_ptr) are invalidated when
the last
shared_ptr is destroyed, although the UNO object may
still be
alive.

@param p object pointer
@return shared_ptr to object
*/
template <typename T>
inline ::boost::shared_ptr<T> make_shared_from_UNO( T * p );


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to