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

Function shared

gecode/kernel/data/array.hpp:1454–1474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1452 */
1453 template<class ViewX, class ViewY>
1454 bool
1455 shared(ViewArray<ViewX> x, ViewArray<ViewY> y) {
1456 if ((x.size() == 0) || (y.size() == 0))
1457 return false;
1458 Region r;
1459 void** px = r.alloc<void*>(x.size());
1460 int j=0;
1461 for (int i=0; i<x.size(); i++)
1462 if (!x[i].assigned() && x[i].varimp())
1463 px[j++] = x[i].varimp();
1464 if (j == 0)
1465 return false;
1466 void** py = r.alloc<void*>(y.size());
1467 int k=0;
1468 for (int i=0; i<y.size(); i++)
1469 if (!y[i].assigned() && y[i].varimp())
1470 py[k++] = y[i].varimp();
1471 if (k == 0)
1472 return false;
1473 return Kernel::duplicates(px,j,py,k);
1474 }
1475
1476 template<class ViewX, class ViewY>
1477 bool

Callers

nothing calls this directly

Calls 4

duplicatesFunction · 0.85
sizeMethod · 0.45
assignedMethod · 0.45
varimpMethod · 0.45

Tested by

no test coverage detected