#include <rutz/arrays.h>

Public Types | |
| typedef T | element_type |
| The pointed-to type. | |
Public Member Functions | |
| shared_array (T *p=0) | |
| Construct with the given array pointer. | |
| shared_array (const shared_array &r) throw () | |
| Copy constructor. | |
| ~shared_array () | |
| Destructor. | |
| shared_array & | operator= (const shared_array &r) |
| Assignment oeprator. | |
| void | reset (T *p=0) |
| Reset to point to a new array. | |
| T * | get () const throw () |
| Get a pointer to the pointed-to array. | |
| T & | operator[] (std::size_t i) const throw () |
| Index into the pointed-to array. | |
| long | use_count () const throw () |
| Get the reference count of the shared array. | |
| bool | unique () const throw () |
| Query whether the shared array is uniquely owned (i.e. refcount == 1). | |
| void | swap (shared_array< T > &other) throw () |
| Swap pointees with another shared_array. | |
The array pointed to is deleted when the last shared_array pointing to it is destroyed or reset.
Definition at line 266 of file arrays.h.
| rutz::shared_array< T >::shared_array | ( | T * | p = 0 |
) | [inline, explicit] |
Construct with the given array pointer.
Ownership is now unconditionally transferred to the shared_array. If the shared_array constructor causes an exception, the pointed-to array will be destroyed.
Definition at line 276 of file arrays.h.
References rutz::mutex_atomic_int::atomic_set().
Referenced by rutz::shared_array< T >::operator=(), and rutz::shared_array< T >::reset().