Gecode::SharedArray< T > Class Template Reference
Shared array with arbitrary number of elements. More...
#include <shared-array.hpp>
Classes | |
class | SAO |
Implementation of object for shared arrays. More... | |
Public Member Functions | |
SharedArray (void) | |
Construct as not yet intialized. | |
SharedArray (int n) | |
Initialize as array with n elements. | |
void | init (int n) |
Initialize as array with n elements. | |
SharedArray (const SharedArray &a) | |
Initialize from shared array a (share elements). | |
SharedArray (const ArgArrayBase< T > &a) | |
Initialize from argument array a. | |
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. | |
Related Functions | |
(Note that these are not member functions.) | |
template<class Char , class Traits , class T > | |
std::basic_ostream< Char, Traits > & | operator<< (std::basic_ostream< Char, Traits > &os, const SharedArray< T > &x) |
Print array elements enclosed in curly brackets. |
Detailed Description
template<class T>
class Gecode::SharedArray< T >
Shared array with arbitrary number of elements.
Sharing is implemented by reference counting: the same elements are shared among several objects.
Definition at line 54 of file shared-array.hpp.
Constructor & Destructor Documentation
Gecode::SharedArray< T >::SharedArray | ( | void | ) | [inline] |
Construct as not yet intialized.
The only member functions that can be used on a constructed but not yet initialized shared array is init and the assignment operator .
Definition at line 177 of file shared-array.hpp.
Gecode::SharedArray< T >::SharedArray | ( | int | n | ) | [inline] |
Initialize as array with n elements.
Definition at line 181 of file shared-array.hpp.
Gecode::SharedArray< T >::SharedArray | ( | const SharedArray< T > & | a | ) | [inline] |
Initialize from shared array a (share elements).
Definition at line 186 of file shared-array.hpp.
Gecode::SharedArray< T >::SharedArray | ( | const ArgArrayBase< T > & | a | ) | [inline] |
Initialize from argument array a.
Definition at line 212 of file shared-array.hpp.
Member Function Documentation
void Gecode::SharedArray< T >::init | ( | int | n | ) | [inline] |
Initialize as array with n elements.
This member function can only be used once and only if the shared array has been constructed with the default constructor.
Definition at line 191 of file shared-array.hpp.
T & Gecode::SharedArray< T >::operator[] | ( | int | i | ) | [inline] |
Access element at position i.
Definition at line 198 of file shared-array.hpp.
const T & Gecode::SharedArray< T >::operator[] | ( | int | i | ) | const [inline] |
Access element at position i.
Definition at line 205 of file shared-array.hpp.
int Gecode::SharedArray< T >::size | ( | void | ) | const [inline] |
Return number of elements.
Definition at line 220 of file shared-array.hpp.
Friends And Related Function Documentation
std::basic_ostream< Char, Traits > & operator<< | ( | std::basic_ostream< Char, Traits > & | os, | |
const SharedArray< T > & | x | |||
) | [related] |
Print array elements enclosed in curly brackets.
Definition at line 227 of file shared-array.hpp.
The documentation for this class was generated from the following file:
- gecode/kernel/shared-array.hpp (Revision: 10026)