Generated on Sun Aug 9 2020 05:34:08 for Gecode by doxygen 1.8.18
Gecode::ArgArray< T > Class Template Reference

Argument array for non-primitive types. More...

#include <array.hpp>

Related Functions

(Note that these are not member functions.)

template<class T >
ArrayTraits< ArgArray< T > >::ArgsType operator+ (const ArgArray< T > &x, const ArgArray< T > &y)
 
template<class T >
ArrayTraits< ArgArray< T > >::ArgsType operator+ (const ArgArray< T > &x, const T &y)
 
template<class T >
ArrayTraits< ArgArray< T > >::ArgsType operator+ (const T &x, const ArgArray< T > &y)
 
template<class Var >
ArrayTraits< VarArgArray< Var > >::ArgsType operator+ (const VarArgArray< Var > &x, const VarArgArray< Var > &y)
 
template<class Var >
ArrayTraits< VarArgArray< Var > >::ArgsType operator+ (const VarArgArray< Var > &x, const Var &y)
 
template<class Var >
ArrayTraits< VarArgArray< Var > >::ArgsType operator+ (const Var &x, const VarArgArray< Var > &y)
 

Constructors and initialization

 ArgArray (void)
 Allocate empty array. More...
 
 ArgArray (int n)
 Allocate array with n elements. More...
 
 ArgArray (int n, const T *e)
 Allocate array with n elements and initialize with elements from array e. More...
 
 ArgArray (const ArgArray< T > &a)
 Initialize from argument array a (copy elements) More...
 
 ArgArray (const std::vector< T > &a)
 Initialize from vector a. More...
 
 ArgArray (std::initializer_list< T > a)
 Initialize from initializer list a. More...
 
template<class InputIterator >
 ArgArray (InputIterator first, InputIterator last)
 Initialize from InputIterator first and last. More...
 

Array elements

ArrayTraits< ArgArray< T > >::ArgsType slice (int start, int inc=1, int n=-1)
 Return slice $y$ of length n such that forall $0\leq i<n$, $y_i=x_{\text{start}+i\cdot\text{inc}}$. More...
 

Appending elements

ArrayTraits< ArgArray< T > >::ArgsType & operator<< (const T &x)
 Insert a new element x at the end of the array (increase size by 1) More...
 
ArrayTraits< ArgArray< T > >::ArgsType & operator<< (const ArgArray< T > &x)
 Append x to the end of the array. More...
 

Detailed Description

template<class T>
class Gecode::ArgArray< T >

Argument array for non-primitive types.

Argument arrays are used as convenient mechanism of passing arguments when calling functions as they combine both the size and the elements of an array. For a small number of elements, memory is allocated by creating an argument array object. Otherwise the memory is allocated from the heap.

Definition at line 656 of file array.hpp.

Constructor & Destructor Documentation

◆ ArgArray() [1/7]

template<class T >
Gecode::ArgArray< T >::ArgArray ( void  )
inline

Allocate empty array.

Definition at line 1750 of file array.hpp.

◆ ArgArray() [2/7]

template<class T >
Gecode::ArgArray< T >::ArgArray ( int  n)
inlineexplicit

Allocate array with n elements.

Definition at line 1754 of file array.hpp.

◆ ArgArray() [3/7]

template<class T >
Gecode::ArgArray< T >::ArgArray ( int  n,
const T *  e 
)

Allocate array with n elements and initialize with elements from array e.

Definition at line 1758 of file array.hpp.

◆ ArgArray() [4/7]

template<class T >
Gecode::ArgArray< T >::ArgArray ( const ArgArray< T > &  a)
inline

Initialize from argument array a (copy elements)

Definition at line 1766 of file array.hpp.

◆ ArgArray() [5/7]

template<class T >
Gecode::ArgArray< T >::ArgArray ( const std::vector< T > &  a)
inline

Initialize from vector a.

Definition at line 1771 of file array.hpp.

◆ ArgArray() [6/7]

template<class T >
Gecode::ArgArray< T >::ArgArray ( std::initializer_list< T >  a)
inline

Initialize from initializer list a.

Definition at line 1776 of file array.hpp.

◆ ArgArray() [7/7]

template<class T >
template<class InputIterator >
Gecode::ArgArray< T >::ArgArray ( InputIterator  first,
InputIterator  last 
)
inline

Initialize from InputIterator first and last.

Definition at line 1782 of file array.hpp.

Member Function Documentation

◆ slice()

template<class T >
ArrayTraits< ArgArray< T > >::ArgsType Gecode::ArgArray< T >::slice ( int  start,
int  inc = 1,
int  n = -1 
)
inline

Return slice $y$ of length n such that forall $0\leq i<n$, $y_i=x_{\text{start}+i\cdot\text{inc}}$.

Definition at line 1787 of file array.hpp.

◆ operator<<() [1/2]

template<class T >
ArrayTraits< ArgArray< T > >::ArgsType & Gecode::ArgArray< T >::operator<< ( const T &  x)
inline

Insert a new element x at the end of the array (increase size by 1)

Definition at line 1794 of file array.hpp.

◆ operator<<() [2/2]

template<class T >
ArrayTraits< ArgArray< T > >::ArgsType & Gecode::ArgArray< T >::operator<< ( const ArgArray< T > &  x)
inline

Append x to the end of the array.

Definition at line 1802 of file array.hpp.

Friends And Related Function Documentation

◆ operator+() [1/6]

template<class T >
ArrayTraits< ArgArray< T > >::ArgsType operator+ ( const ArgArray< T > &  x,
const ArgArray< T > &  y 
)
related

Concatenate x and y and return result

Definition at line 1811 of file array.hpp.

◆ operator+() [2/6]

template<class T >
ArrayTraits< ArgArray< T > >::ArgsType operator+ ( const ArgArray< T > &  x,
const T &  y 
)
related

Concatenate x and y and return result

Definition at line 1818 of file array.hpp.

◆ operator+() [3/6]

template<class T >
ArrayTraits< ArgArray< T > >::ArgsType operator+ ( const T &  x,
const ArgArray< T > &  y 
)
related

Concatenate x and y and return result

Definition at line 1825 of file array.hpp.

◆ operator+() [4/6]

template<class Var >
ArrayTraits< VarArgArray< Var > >::ArgsType operator+ ( const VarArgArray< Var > &  x,
const VarArgArray< Var > &  y 
)
related

Concatenate x and y and return result

Definition at line 1900 of file array.hpp.

◆ operator+() [5/6]

template<class Var >
ArrayTraits< VarArgArray< Var > >::ArgsType operator+ ( const VarArgArray< Var > &  x,
const Var y 
)
related

Concatenate x and y and return result

Definition at line 1907 of file array.hpp.

◆ operator+() [6/6]

template<class Var >
ArrayTraits< VarArgArray< Var > >::ArgsType operator+ ( const Var x,
const VarArgArray< Var > &  y 
)
related

Concatenate x and y and return result

Definition at line 1914 of file array.hpp.


The documentation for this class was generated from the following file: