Generated on Sat Jun 2 2018 07:17:44 for Gecode by doxygen 1.8.13
array.hpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  *
6  * Copyright:
7  * Christian Schulte, 2005
8  *
9  * This file is part of Gecode, the generic constraint
10  * development environment:
11  * http://www.gecode.org
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining
14  * a copy of this software and associated documentation files (the
15  * "Software"), to deal in the Software without restriction, including
16  * without limitation the rights to use, copy, modify, merge, publish,
17  * distribute, sublicense, and/or sell copies of the Software, and to
18  * permit persons to whom the Software is furnished to do so, subject to
19  * the following conditions:
20  *
21  * The above copyright notice and this permission notice shall be
22  * included in all copies or substantial portions of the Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31  *
32  */
33 
34 namespace Gecode {
35 
36  /*
37  * Implementation
38  *
39  */
40 
42  IntArgs::IntArgs(void) : PrimArgArray<int>(0) {}
43 
45  IntArgs::IntArgs(int n) : PrimArgArray<int>(n) {}
46 
49  : PrimArgArray<int>(x.size()) {
50  for (int i=x.size(); i--;)
51  a[i] = x[i];
52  }
54  IntArgs::IntArgs(const std::vector<int>& x)
55  : PrimArgArray<int>(x) {}
56  template<class InputIterator>
58  IntArgs::IntArgs(InputIterator first, InputIterator last)
59  : PrimArgArray<int>(first,last) {}
60 
62  IntArgs::IntArgs(int n, const int* e) : PrimArgArray<int>(n, e) {}
63 
66 
68  IntArgs::create(int n, int start, int inc) {
69  IntArgs r(n);
70  for (int i=0; i<n; i++, start+=inc)
71  r[i] = start;
72  return r;
73  }
74 
77 
80  : VarArray<IntVar>(home,n) {}
81 
84  : VarArray<IntVar>(a) {}
85 
88  : VarArray<IntVar>(home,a) {}
89 
90 
93 
96  : VarArray<BoolVar>(home,n) {}
97 
100  : VarArray<BoolVar>(a) {}
101 
104  : VarArray<BoolVar>(home,a) {}
105 
106 }
107 
108 // STATISTICS: int-other
static IntArgs create(int n, int start, int inc=1)
Allocate array with n elements such that for all .
Definition: array.hpp:68
IntVarArray(void)
Default constructor (array of size 0)
Definition: array.hpp:76
BoolVarArray(void)
Default constructor (array of size 0)
Definition: array.hpp:92
int size(void) const
Return size of array (number of elements)
Definition: array.hpp:1653
Argument array for primtive types.
Definition: array.hpp:624
Integer variable array.
Definition: int.hh:738
Variable arrays
Definition: array.hpp:48
#define forceinline
Definition: config.hpp:185
Computation spaces.
Definition: core.hpp:1701
Gecode::IntArgs i(4, 1, 2, 3, 4)
IntArgs(void)
Allocate empty array.
Definition: array.hpp:42
int size(void) const
Return number of elements.
int n
Number of variables (size)
Definition: array.hpp:85
Passing integer variables.
Definition: int.hh:633
Passing integer arguments.
Definition: int.hh:604
Passing Boolean variables.
Definition: int.hh:687
Boolean variable array.
Definition: int.hh:783
Boolean integer variables.
Definition: int.hh:488
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition: set.hh:765
struct Gecode::@585::NNF::@62::@64 a
For atomic nodes.
Integer variables.
Definition: int.hh:347
Post propagator for SetVar x
Definition: set.hh:765
int n
Number of elements.
Definition: array.hpp:511
Gecode toplevel namespace
int * a
Element array.
Definition: array.hpp:515