Gecode::VarArray< Var > Class Template Reference
[Programming variables]
Variable arrays More...
#include <array.hpp>
Public Member Functions | |
bool | assigned (void) const |
Test if all variables are assigned. | |
Protected Attributes | |
int | n |
Number of variables (size). | |
Var * | x |
Array of variables. | |
Related Functions | |
(Note that these are not member functions.) | |
template<class T > | |
ArrayTraits< VarArray< T > >::ArgsType | operator+ (const VarArray< T > &x, const VarArgArray< T > &y) |
template<class T > | |
ArrayTraits< VarArray< T > >::ArgsType | operator+ (const VarArray< T > &x, const VarArray< T > &y) |
template<class T > | |
ArrayTraits< VarArray< T > >::ArgsType | operator+ (const VarArgArray< T > &x, const VarArray< T > &y) |
template<class T > | |
ArrayTraits< VarArray< T > >::ArgsType | operator+ (const VarArray< T > &x, const T &y) |
template<class T > | |
ArrayTraits< VarArray< T > >::ArgsType | operator+ (const T &x, const VarArray< T > &y) |
template<class Char , class Traits , class Var > | |
std::basic_ostream< Char, Traits > & | operator<< (std::basic_ostream< Char, Traits > &os, const VarArray< Var > &x) |
Print array elements enclosed in curly brackets. | |
Constructors and initialization | |
| |
VarArray (void) | |
Default constructor (array of size 0). | |
VarArray (Space &home, int m) | |
Allocate array with m variables. | |
VarArray (Space &home, const VarArgArray< Var > &) | |
Initialize from variable argument array a (copy elements). | |
VarArray (const VarArray< Var > &a) | |
Initialize from variable array a (share elements). | |
const VarArray< Var > & | operator= (const VarArray< Var > &a) |
Initialize from variable array a (share elements). | |
Array size | |
| |
int | size (void) const |
Return size of array (number of elements). | |
Array elements | |
| |
Var & | operator[] (int i) |
Return variable at position i. | |
const Var & | operator[] (int i) const |
Return variable at position i. | |
ArrayTraits< VarArgArray< Var > >::ArgsType | slice (int start, int inc=1, int n=-1) |
Cloning | |
| |
void | update (Space &, bool share, VarArray< Var > &a) |
Update array to be a clone of array a. |
Detailed Description
template<class Var>
class Gecode::VarArray< Var >
Variable arrays
Variable arrays store variables. They are typically used for storing the variables being part of a solution.
Never use them for temporary purposes, use argument arrays instead.
Variable arrays can be enlarged dynamically. For memory efficiency, the initial array is allocated in the space. When adding variables, it is automatically resized and allocated on the heap.
Definition at line 80 of file array.hpp.
Constructor & Destructor Documentation
template<class Var >
Gecode::VarArray< Var >::VarArray | ( | void | ) | [inline] |
template<class Var >
Gecode::VarArray< Var >::VarArray | ( | Space & | home, | |
int | m | |||
) | [inline] |
template<class Var>
Gecode::VarArray< Var >::VarArray | ( | Space & | home, | |
const VarArgArray< Var > & | a | |||
) | [inline] |
template<class Var>
Gecode::VarArray< Var >::VarArray | ( | const VarArray< Var > & | a | ) | [inline] |
Member Function Documentation
template<class Var >
int Gecode::VarArray< Var >::size | ( | void | ) | const [inline] |
template<class Var >
Var & Gecode::VarArray< Var >::operator[] | ( | int | i | ) | [inline] |
template<class Var >
const Var & Gecode::VarArray< Var >::operator[] | ( | int | i | ) | const [inline] |
template<class Var >
ArrayTraits< VarArgArray< Var > >::ArgsType Gecode::VarArray< Var >::slice | ( | int | start, | |
int | inc = 1 , |
|||
int | n = -1 | |||
) |
template<class Var >
bool Gecode::VarArray< Var >::assigned | ( | void | ) | const [inline] |
template<class Var>
void Gecode::VarArray< Var >::update | ( | Space & | home, | |
bool | share, | |||
VarArray< Var > & | a | |||
) | [inline] |
Friends And Related Function Documentation
template<class T >
ArrayTraits< VarArray< T > >::ArgsType operator+ | ( | const VarArray< T > & | x, | |
const VarArgArray< T > & | y | |||
) | [related] |
Concatenate x and y and return result
template<class T >
ArrayTraits< VarArray< T > >::ArgsType operator+ | ( | const VarArray< T > & | x, | |
const VarArray< T > & | y | |||
) | [related] |
Concatenate x and y and return result
template<class T >
ArrayTraits< VarArray< T > >::ArgsType operator+ | ( | const VarArgArray< T > & | x, | |
const VarArray< T > & | y | |||
) | [related] |
Concatenate x and y and return result
template<class T >
ArrayTraits< VarArray< T > >::ArgsType operator+ | ( | const VarArray< T > & | x, | |
const T & | y | |||
) | [related] |
Concatenate x and y and return result
template<class T >
ArrayTraits< VarArray< T > >::ArgsType operator+ | ( | const T & | x, | |
const VarArray< T > & | y | |||
) | [related] |
Concatenate x and y and return result
Member Data Documentation
template<class Var>
int Gecode::VarArray< Var >::n [protected] |
template<class Var>
Var* Gecode::VarArray< Var >::x [protected] |
The documentation for this class was generated from the following file:
- gecode/kernel/array.hpp (Revision: 11014)