Gecode::Support::SharedArray< T, fd > Class Template Reference
[Support algorithms and datastructures]
#include <shared-array.hh>
Detailed Description
template<class T, bool fd = false>
class Gecode::Support::SharedArray< T, fd >
Shared array with arbitrary number of elements.
Sharing is implemented by reference counting: the same elements are shared among several objects.
If the template parameter fd is true, the destructors of all objects in the array will be called when the array is deallocated, i.e. when its reference count drops to zero.
Requires
#include "gecode/support/shared-array.hh"
Definition at line 45 of file shared-array.hh.
Public Member Functions | |
SharedArray (void) | |
Initialize as empty array. | |
SharedArray (int n) | |
Initialize as array with n elements. | |
SharedArray (const SharedArray< T, fd > &a) | |
Initialize from shared array a (share elements). | |
const SharedArray & | operator= (const SharedArray &) |
Initialize from shared array a (share elements). | |
void | update (bool share, SharedArray &a) |
Update this array from array a (share elements if share is true). | |
~SharedArray (void) | |
Delete array (elements might be still in use). | |
T & | operator[] (int i) |
Access element at position i. | |
const T & | operator[] (int i) const |
Access element at position i. | |
int | size (void) const |
Return number of elements. | |
void | size (int n) |
Change size to n. | |
void | shrink (int n) |
Shrink array to n elements. | |
void | ensure (int n) |
Ensure that array has at least n elements. |
Constructor & Destructor Documentation
|
Initialize as empty array.
Definition at line 143 of file shared-array.hh. |
|
Initialize as array with n elements.
Definition at line 147 of file shared-array.hh. |
|
Initialize from shared array a (share elements).
Definition at line 152 of file shared-array.hh. |
|
Delete array (elements might be still in use).
Definition at line 160 of file shared-array.hh. |
Member Function Documentation
|
Initialize from shared array a (share elements).
|
|
Update this array from array a (share elements if share is true).
|
|
Access element at position i.
Definition at line 194 of file shared-array.hh. |
|
Access element at position i.
Definition at line 200 of file shared-array.hh. |
|
Return number of elements.
Definition at line 206 of file shared-array.hh. |
|
Change size to n.
Definition at line 212 of file shared-array.hh. |
|
Shrink array to n elements.
Definition at line 224 of file shared-array.hh. |
|
Ensure that array has at least n elements.
Definition at line 235 of file shared-array.hh. |
The documentation for this class was generated from the following file:
- gecode/support/shared-array.hh (Revision: 3514)