Rosetta 3.4
utility::pointer::access_ptr Class Reference

Detailed Description

access_ptr is a simple pointer wrapper that you can't (directly) delete that is meant for pointing to access objects that are not owned. access_ptr objects can be stored in STL containers and are as small and as fast as raw pointers. Deletion of the wrapped pointer is still possible so this is not bulletproof against determined misuse.

Remarks:

The object pointed to by access_ptr need not be allocated on the heap since access_ptr never deletes the object it points to.

Pointers to const objects: access_ptr< Type const >

Virtual functions shouldn't return access_ptr because, like all template-based smart pointers, it doesn't support covariant return types but raw pointer return values can be assigned to access_ptr.

Casts: The cast functions are merely a convenience for access_ptr (unlike for non-intrusive shared ownership pointers) so for:

access_ptr< Base > pB( new Derived() );

the cast:

dynamic_pointer_cast< Derived >( pB );

is equivalent to:

access_ptr< Derived >( dynamic_cast< Derived * >( pB() ) );


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines