12{
15
16 auto leftIt = left.begin();
17 auto rightIt = right.begin();
18 auto leftEnd = left.end();
19 auto rightEnd = right.end();
20 auto resultIt =
result.begin();
21
22 while (true)
23 {
24 if (leftIt == leftEnd)
25 {
26
27 if (useRight)
28 {
29 std::copy(rightIt.loc(),rightEnd.loc(),resultIt.loc());
30 resultIt += ((rightEnd.loc() - rightIt.loc()) >> 1);
31 }
32 break;
33 }
34 if (rightIt == rightEnd)
35 {
36
37 if (useLeft)
38 {
39 std::copy(leftIt.loc(),leftEnd.loc(),resultIt.loc());
40 resultIt += ((leftEnd.loc() - leftIt.loc()) >> 1);
41 }
42 break;
43 }
44 if (leftIt.var() < rightIt.var())
45 {
46
47 std::copy(leftIt.loc(), leftIt.loc() + 2, resultIt.loc());
48 ++resultIt;
49 ++leftIt;
50 }
51 else if (leftIt.var() > rightIt.var())
52 {
53
54 std::copy(rightIt.loc(), rightIt.loc() + 2, resultIt.loc());
55 ++resultIt;
56 ++rightIt;
57 }
58 else
59 {
60
61 resultIt.loc()[0] = leftIt.var();
62 auto temp = bothFunc(leftIt.power(), rightIt.power());
63 if (temp > 0)
64 {
65 resultIt.loc()[1] = bothFunc(leftIt.power(), rightIt.power());
66 ++resultIt;
67 }
68 ++leftIt;
69 ++rightIt;
70 }
71 }
73 *
rng.first = resultIt.loc() -
rng.first;
75}
std::pair< T *, T * > shrinkLastAllocate(T *begin, T *end, T *newtop)
std::pair< T *, T * > allocateArray(size_t nelems)
MonomialView(MonomialInt *data)
VALGRIND_MAKE_MEM_DEFINED & result(result)