Generated on Tue Jan 28 2020 00:00:00 for Gecode by doxygen 1.8.17
Gecode::PrimArgArray< T > Class Template Reference

Argument array for primtive types. More...

#include <array.hpp>

Related Functions

(Note that these are not member functions.)

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

Constructors and initialization

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

Array elements

ArrayTraits< PrimArgArray< T > >::ArgsType slice (int start, int inc=1, int n=-1)
 

Appending elements

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

Detailed Description

template<class T>
class Gecode::PrimArgArray< T >

Argument array for primtive 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 640 of file array.hpp.

Constructor & Destructor Documentation

◆ PrimArgArray() [1/7]

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

Allocate empty array.

Definition at line 1811 of file array.hpp.

◆ PrimArgArray() [2/7]

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

Allocate array with n elements.

Definition at line 1815 of file array.hpp.

◆ PrimArgArray() [3/7]

template<class T >
Gecode::PrimArgArray< T >::PrimArgArray ( int  n,
e0,
  ... 
)

Allocate array with n elements and initialize with e0, ...

Definition at line 1818 of file array.hpp.

◆ PrimArgArray() [4/7]

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

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

Definition at line 1829 of file array.hpp.

◆ PrimArgArray() [5/7]

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

Initialize from primitive argument array a (copy elements)

Definition at line 1837 of file array.hpp.

◆ PrimArgArray() [6/7]

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

Initialize from vector a.

Definition at line 1842 of file array.hpp.

◆ PrimArgArray() [7/7]

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

Initialize from InputIterator first and last.

Definition at line 1848 of file array.hpp.

Member Function Documentation

◆ slice()

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

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

If n is -1, then all possible elements starting from start with increment inc are returned.

Definition at line 1853 of file array.hpp.

◆ operator<<() [1/2]

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

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

Definition at line 1861 of file array.hpp.

◆ operator<<() [2/2]

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

Append x to the end of the array.

Definition at line 1869 of file array.hpp.

Friends And Related Function Documentation

◆ operator+() [1/3]

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

Concatenate x and y and return result

Definition at line 1877 of file array.hpp.

◆ operator+() [2/3]

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

Concatenate x and y and return result

Definition at line 1884 of file array.hpp.

◆ operator+() [3/3]

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

Concatenate x and y and return result

Definition at line 1891 of file array.hpp.


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