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

Function same

gecode/kernel/data/array.hpp:1925–1945  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1923 */
1924 template<class Var>
1925 bool
1926 same(VarArgArray<Var> x, VarArgArray<Var> y) {
1927 if ((x.size() == 0) || (y.size() == 0))
1928 return false;
1929 Region r;
1930 void** px = r.alloc<void*>(x.size());
1931 int j=0;
1932 for (int i=0; i<x.size(); i++)
1933 if (!x[i].assigned())
1934 px[j++] = x[i].varimp();
1935 if (j == 0)
1936 return false;
1937 void** py = r.alloc<void*>(y.size());
1938 int k=0;
1939 for (int i=0; i<y.size(); i++)
1940 if (!y[i].assigned())
1941 py[k++] = y[i].varimp();
1942 if (k == 0)
1943 return false;
1944 return Kernel::duplicates(px,j,py,k);
1945 }
1946
1947 template<class Var>
1948 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