# bdm::object_ptr< T > Class Template Reference

A wrapper of shared_ptr which is never empty. More...

`#include <shared_ptr.h>`

List of all members.

## Public Member Functions
| object_ptr ()
| Default constructor.
| object_ptr (const shared_ptr< T > &b)
| Upcast from shared_ptr<T> to object_ptr<T>.
| object_ptr (T *p)
object_ptr< T > & | operator= (const object_ptr< T > &other)
T * | get ()
const T * | get () const
T * | operator-> ()
const T * | operator-> () const
T & | operator* ()
const T & | operator* () const
bool | unique () const
long | use_count () const
| operator bool () const
void | swap (shared_ptr &other)

## Detailed Description

### template<typename T>
class bdm::object_ptr< T >

A wrapper of shared_ptr which is never empty.

T must have a default constructor.

Note that shared_ptr's destructor isn't virtual - don't call delete on pointers to instances of this class.

## Constructor & Destructor Documentation

template<typename T>

bdm::object_ptr< T >::object_ptr | ( |  | ) | `[inline]`

Default constructor.

Calls T's default constructor.

template<typename T>

bdm::object_ptr< T >::object_ptr | ( | const shared_ptr< T > & | b | ) | `[inline]`

Upcast from shared_ptr<T> to object_ptr<T>.

Parameters:

  | b | The shared pointer, which must not be empty.

template<typename T>

bdm::object_ptr< T >::object_ptr | ( | T * | p | ) | `[inline]`

Constructs an object_ptr that owns the pointer p. p must have been alllocated by new!

## Member Function Documentation

const T * bdm::shared_ptr< T >::get | ( |  | ) | const`[inline, inherited]`

Returns the stored pointer (which remains owned by this instance).

T * bdm::shared_ptr< T >::get | ( |  | ) | `[inline, inherited]`

Returns the stored pointer (which remains owned by this instance).

const T & bdm::shared_ptr< T >::operator* | ( |  | ) | const`[inline, inherited]`

Returns a reference to the object pointed to by the stored pointer. This method may only be called when the stored pointer isn't NULL.

T & bdm::shared_ptr< T >::operator* | ( |  | ) | `[inline, inherited]`

Returns a reference to the object pointed to by the stored pointer. This method may only be called when the stored pointer isn't NULL.

const T * bdm::shared_ptr< T >::operator-> | ( |  | ) | const`[inline, inherited]`

Returns the stored pointer (which remains owned by this instance). This method may only be called when the stored pointer isn't NULL.

T * bdm::shared_ptr< T >::operator-> | ( |  | ) | `[inline, inherited]`

Returns the stored pointer (which remains owned by this instance). This method may only be called when the stored pointer isn't NULL.

The documentation for this class was generated from the following file:

- shared_ptr.h