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
template<class T, bool fd>
Gecode::Support::SharedArray< T, fd >::SharedArray | ( | void | ) | [inline] |
template<class T, bool fd>
Gecode::Support::SharedArray< T, fd >::SharedArray | ( | int | n | ) | [inline] |
template<class T, bool fd>
Gecode::Support::SharedArray< T, fd >::SharedArray | ( | const SharedArray< T, fd > & | a | ) | [inline] |
template<class T, bool fd>
Gecode::Support::SharedArray< T, fd >::~SharedArray | ( | void | ) | [inline] |
Member Function Documentation
template<class T, bool fd = false>
const SharedArray& Gecode::Support::SharedArray< T, fd >::operator= | ( | const SharedArray< T, fd > & | ) |
Initialize from shared array a (share elements).
template<class T, bool fd = false>
void Gecode::Support::SharedArray< T, fd >::update | ( | bool | share, | |
SharedArray< T, fd > & | a | |||
) |
Update this array from array a (share elements if share is true).
template<class T, bool fd>
T & Gecode::Support::SharedArray< T, fd >::operator[] | ( | int | i | ) | [inline] |
template<class T, bool fd>
const T & Gecode::Support::SharedArray< T, fd >::operator[] | ( | int | i | ) | const [inline] |
template<class T, bool fd>
int Gecode::Support::SharedArray< T, fd >::size | ( | void | ) | const [inline] |
template<class T, bool fd>
void Gecode::Support::SharedArray< T, fd >::size | ( | int | n | ) | [inline] |
template<class T, bool fd>
void Gecode::Support::SharedArray< T, fd >::shrink | ( | int | n | ) | [inline] |
template<class T, bool fd>
void Gecode::Support::SharedArray< T, fd >::ensure | ( | int | n | ) | [inline] |
The documentation for this class was generated from the following file:
- gecode/support/shared-array.hh (Revision: 3514)