Variable arrays More...
#include <array.hpp>
Public Member Functions | |
bool | assigned (void) const |
Test if all variables are assigned. More... | |
Protected Attributes | |
int | n |
Number of variables (size) More... | |
Var * | x |
Array of variables. More... | |
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. More... | |
Associated types | |
typedef Var | value_type |
Type of the variable stored in this array. More... | |
typedef Var & | reference |
Type of a reference to the value type. More... | |
typedef const Var & | const_reference |
Type of a constant reference to the value type. More... | |
typedef Var * | pointer |
Type of a pointer to the value type. More... | |
typedef const Var * | const_pointer |
Type of a read-only pointer to the value type. More... | |
typedef Var * | iterator |
Type of the iterator used to iterate through this array's elements. More... | |
typedef const Var * | const_iterator |
Type of the iterator used to iterate read-only through this array's elements. More... | |
typedef std::reverse_iterator< Var * > | reverse_iterator |
Type of the iterator used to iterate backwards through this array's elements. More... | |
typedef std::reverse_iterator< const Var * > | const_reverse_iterator |
Type of the iterator used to iterate backwards and read-only through this array's elements. More... | |
Constructors and initialization | |
VarArray (void) | |
Default constructor (array of size 0) More... | |
VarArray (Space &home, int m) | |
Allocate array with m variables. More... | |
VarArray (Space &home, const VarArgArray< Var > &) | |
Initialize from variable argument array a (copy elements) More... | |
VarArray (const VarArray< Var > &a) | |
Initialize from variable array a (share elements) More... | |
const VarArray< Var > & | operator= (const VarArray< Var > &a) |
Initialize from variable array a (share elements) More... | |
Array size | |
int | size (void) const |
Return size of array (number of elements) More... | |
Array elements | |
Var & | operator[] (int i) |
Return variable at position i. More... | |
const Var & | operator[] (int i) const |
Return variable at position i. More... | |
ArrayTraits< VarArgArray< Var > >::ArgsType | slice (int start, int inc=1, int n=-1) |
Array iteration | |
iterator | begin (void) |
Return an iterator at the beginning of the array. More... | |
const_iterator | begin (void) const |
Return a read-only iterator at the beginning of the array. More... | |
iterator | end (void) |
Return an iterator past the end of the array. More... | |
const_iterator | end (void) const |
Return a read-only iterator past the end of the array. More... | |
reverse_iterator | rbegin (void) |
Return a reverse iterator at the end of the array. More... | |
const_reverse_iterator | rbegin (void) const |
Return a reverse and read-only iterator at the end of the array. More... | |
reverse_iterator | rend (void) |
Return a reverse iterator past the beginning of the array. More... | |
const_reverse_iterator | rend (void) const |
Return a reverse and read-only iterator past the beginning of the array. More... | |
Cloning | |
void | update (Space &, bool share, VarArray< Var > &a) |
Update array to be a clone of array a. More... | |
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.
typedef Var Gecode::VarArray< Var >::value_type |
typedef Var& Gecode::VarArray< Var >::reference |
typedef const Var& Gecode::VarArray< Var >::const_reference |
typedef Var* Gecode::VarArray< Var >::pointer |
typedef const Var* Gecode::VarArray< Var >::const_pointer |
typedef Var* Gecode::VarArray< Var >::iterator |
typedef const Var* Gecode::VarArray< Var >::const_iterator |
typedef std::reverse_iterator<Var*> Gecode::VarArray< Var >::reverse_iterator |
typedef std::reverse_iterator<const Var*> Gecode::VarArray< Var >::const_reverse_iterator |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
ArrayTraits< VarArgArray< Var > >::ArgsType Gecode::VarArray< Var >::slice | ( | int | start, |
int | inc = 1 , |
||
int | n = -1 |
||
) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
related |
Concatenate x and y and return result
|
related |
Concatenate x and y and return result
|
related |
Concatenate x and y and return result
|
related |
Concatenate x and y and return result
|
related |
Concatenate x and y and return result
|
protected |
|
protected |