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

Method init

gecode/int/int-set-1.hpp:56–72  ·  view source on GitHub ↗

Initialize \a s with iterator \a i

Source from the content-addressed store, hash-verified

54 public:
55 /// Initialize \a s with iterator \a i
56 static void init(IntSet& s, I& i) {
57 Region reg;
58 Support::DynamicArray<IntSet::Range,Region> d(reg);
59 int n=0;
60 unsigned int size = 0;
61 while (i()) {
62 d[n].min = i.min(); d[n].max = i.max(); size += i.width();
63 ++n; ++i;
64 }
65 if (n > 0) {
66 IntSet::IntSetObject* o = IntSet::IntSetObject::allocate(n);
67 for (int j=0; j<n; j++)
68 o->r[j]=d[j];
69 o->size = size;
70 s.object(o);
71 }
72 }
73 };
74
75 /// Initialize integer set with integer set

Callers

nothing calls this directly

Calls 5

iFunction · 0.50
minMethod · 0.45
maxMethod · 0.45
widthMethod · 0.45
objectMethod · 0.45

Tested by

no test coverage detected