MCPcopy Create free account
hub / github.com/Gecode/gecode / weightI

Function weightI

gecode/set/int/weights.hpp:216–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214 /// Compute the weight of the elements in the iterator \a I
215 template<class I>
216 forceinline
217 int weightI(SharedArray<int>& elements,
218 SharedArray<int>& weights,
219 I& iter) {
220 int sum = 0;
221 int i = 0;
222 Iter::Ranges::ToValues<I> v(iter);
223 for (; v(); ++v) {
224 // Skip all elements below the current
225 while (elements[i]<v.val()) i++;
226 assert(elements[i] == v.val());
227 sum += weights[i];
228 }
229 assert(!v());
230 return sum;
231 }
232
233
234 /// Sort order for integers

Callers

nothing calls this directly

Calls 1

valMethod · 0.45

Tested by

no test coverage detected