Views
Foundation Package API Reference Guide
Product Documentation:
Views Documentation Home
IlSharedPtr< T > Class Template Reference

Manages the storage of a pointer, providing a limited garbage-collection facility, possibly sharing that management with other objects. More...

#include <ilog/shrptr.h>

Public Member Functions

  IlSharedPtr (const IlSharedPtr< T > &other)
  Copy constructor. More...
 
  IlSharedPtr (T *ptr=0)
  Constructor. More...
 
  ~IlSharedPtr ()
  Destructor. More...
 
T *  get () const
  Access to the encapsulated pointer. More...
 
IlSharedPtr< T > &  operator= (const IlSharedPtr< T > &other)
  Assignment operator. More...
 

Detailed Description

template<class T>
class IlSharedPtr< T >

Manages the storage of a pointer, providing a limited garbage-collection facility, possibly sharing that management with other objects.

Library: ilog

This template class is largely inspired from the share_ptr template class provided in the ISO C++ Standard Template Library. It is replicated here (and substantially simplified) because of portability limitations. Only crucial methods are implemented.

Constructor & Destructor Documentation

◆ IlSharedPtr() [1/2]

template<class T >
IlSharedPtr< T >::IlSharedPtr ( T *  ptr = 0 )

Constructor.

Creates an initial reference on the pointer.

◆ IlSharedPtr() [2/2]

template<class T >
IlSharedPtr< T >::IlSharedPtr ( const IlSharedPtr< T > &  other )

Copy constructor.

Creates an additional reference on the encapsulated pointer.

◆ ~IlSharedPtr()

template<class T >
IlSharedPtr< T >::~IlSharedPtr ( )

Destructor.

If no other smart pointer is sharing the encapsulated pointer, then it is deleted.

Member Function Documentation

◆ get()

template<class T >
T* IlSharedPtr< T >::get ( ) const

Access to the encapsulated pointer.

Returns
The encapsulated pointer.

◆ operator=()

template<class T >
IlSharedPtr<T>& IlSharedPtr< T >::operator= ( const IlSharedPtr< T > &  other )

Assignment operator.

Parameters
other The shared pointer to be copied.