Generated on Wed Jul 21 2021 00:00:00 for Gecode by doxygen 1.9.1
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) : ArgArray<int>(0) {}
43 
45  IntArgs::IntArgs(int n) : ArgArray<int>(n) {}
46 
49  : ArgArray<int>(x.size()) {
50  for (int i=0; i<x.size(); i++)
51  a[i] = x[i];
52  }
53 
55  IntArgs::IntArgs(const std::vector<int>& x)
56  : ArgArray<int>(x) {}
57 
59  IntArgs::IntArgs(std::initializer_list<int> x)
60  : ArgArray<int>(x) {}
61 
62  template<class InputIterator>
64  IntArgs::IntArgs(InputIterator first, InputIterator last)
65  : ArgArray<int>(first,last) {}
66 
68  IntArgs::IntArgs(int n, const int* e)
69  : ArgArray<int>(n, e) {}
70 
73  : ArgArray<int>(a) {}
74 
76  IntArgs::create(int n, int start, int inc) {
77  IntArgs r(n);
78  for (int i=0; i<n; i++, start+=inc)
79  r[i] = start;
80  return r;
81  }
82 
83 
86 
89  : VarArgArray<IntVar>(n) {}
90 
93  : VarArgArray<IntVar>(a) {}
94 
97  : VarArgArray<IntVar>(a) {}
98 
100  IntVarArgs::IntVarArgs(const std::vector<IntVar>& a)
101  : VarArgArray<IntVar>(a) {}
102 
104  IntVarArgs::IntVarArgs(std::initializer_list<IntVar> a)
105  : VarArgArray<IntVar>(a) {}
106 
107  template<class InputIterator>
109  IntVarArgs::IntVarArgs(InputIterator first, InputIterator last)
110  : VarArgArray<IntVar>(first,last) {}
111 
112 
115 
118  : VarArgArray<BoolVar>(n) {}
119 
122  : VarArgArray<BoolVar>(a) {}
123 
126  : VarArgArray<BoolVar>(a) {}
127 
129  BoolVarArgs::BoolVarArgs(const std::vector<BoolVar>& a)
130  : VarArgArray<BoolVar>(a) {}
131 
133  BoolVarArgs::BoolVarArgs(std::initializer_list<BoolVar> a)
134  : VarArgArray<BoolVar>(a) {}
135 
136  template<class InputIterator>
138  BoolVarArgs::BoolVarArgs(InputIterator first, InputIterator last)
139  : VarArgArray<BoolVar>(first,last) {}
140 
141 
144 
147  : VarArray<IntVar>(home,n) {}
148 
151  : VarArray<IntVar>(a) {}
152 
155  : VarArray<IntVar>(home,a) {}
156 
157 
160 
163  : VarArray<BoolVar>(home,n) {}
164 
167  : VarArray<BoolVar>(a) {}
168 
171  : VarArray<BoolVar>(home,a) {}
172 
173 }
174 
175 // STATISTICS: int-other
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:249
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
NNF * r
Right subtree.
Definition: bool-expr.cpp:242
T * a
Element array.
Definition: array.hpp:544
int n
Number of elements.
Definition: array.hpp:540
Argument array for non-primitive types.
Definition: array.hpp:691
Passing Boolean variables.
Definition: int.hh:712
BoolVarArgs(void)
Allocate empty array.
Definition: array.hpp:114
Boolean variable array.
Definition: int.hh:808
BoolVarArray(void)
Default constructor (array of size 0)
Definition: array.hpp:159
Boolean integer variables.
Definition: int.hh:512
Passing integer arguments.
Definition: int.hh:628
static IntArgs create(int n, int start, int inc=1)
Allocate array with n elements such that for all .
Definition: array.hpp:76
IntArgs(void)
Allocate empty array.
Definition: array.hpp:42
Passing integer variables.
Definition: int.hh:656
IntVarArgs(void)
Allocate empty array.
Definition: array.hpp:85
Integer variable array.
Definition: int.hh:763
IntVarArray(void)
Default constructor (array of size 0)
Definition: array.hpp:143
Integer variables.
Definition: int.hh:371
Computation spaces.
Definition: core.hpp:1742
Argument array for variables.
Definition: array.hpp:774
unsigned int size(I &i)
Size of all ranges of range iterator i.
Gecode::IntArgs i({1, 2, 3, 4})
#define forceinline
Definition: config.hpp:192