Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ template compiler error
    primarykey
    data
    text
    <p>I'm updating some older Visual Studio C++ code and can't determine what is wrong with this code. </p> <pre><code>TLineApproximator&lt;T&gt;::PointContainer::iterator TDPHull&lt;typename T&gt;::DP(typename PointContainer::iterator it, typename PointContainer::iterator jt) { static double ld, rd, len_sq; static SHomog l; register SPoint *le; register SPoint *re; SPoint* i=&amp;(*it); SPoint* j=&amp;(*jt); SPoint::CrossProduct(*i, *j, l); len_sq = l.x * l.x + l.y * l.y; if (j - i &lt; 8) { /* chain small */ rd = 0.0; for (le = i + 1; le &lt; j; le++) { ld = SPoint::DotProduct(*le, l); if (ld &lt; 0) ld = - ld; if (ld &gt; rd) { rd = ld; re = le; } } if (rd * rd &gt; GetTol() * len_sq) { OutputVertex(DP(i, re)); return(DP(re, j)); } else return(j); } else { /* chain large */ int sbase, sbrk, mid, lo, m1, brk, m2, hi; double d1, d2; if ((m_phLeft.GetTop() - m_phLeft.GetBot()) &gt; 8) { /* left hull large */ lo = m_phLeft.GetBot(); hi = m_phLeft.GetTop() - 1; sbase = m_phLeft.SlopeSign(hi, lo, l); do { brk = (lo + hi) / 2; if (sbase == (sbrk = m_phLeft.SlopeSign(brk, brk+1, l))) if (sbase == (m_phLeft.SlopeSign(lo, brk+1, l))) lo = brk + 1; else hi = brk; } while (sbase == sbrk &amp;&amp; lo &lt; hi); m1 = brk; while (lo &lt; m1) { mid = (lo + m1) / 2; if (sbase == (m_phLeft.SlopeSign(mid, mid+1, l))) lo = mid + 1; else m1 = mid; } m2 = brk; while (m2 &lt; hi) { mid = (m2 + hi) / 2; if (sbase == (m_phLeft.SlopeSign(mid, mid+1, l))) hi = mid; else m2 = mid + 1; }; if ((d1 = SPoint::DotProduct(*m_phLeft.GetpElt(lo), l)) &lt; 0) d1 = - d1; if ((d2 = SPoint::DotProduct(*m_phLeft.GetpElt(m2), l)) &lt; 0) d2 = - d2; ld = (d1 &gt; d2 ? (le = m_phLeft.GetpElt(lo), d1) : (le = m_phLeft.GetpElt(m2), d2)); } else { /* Few SPoints in left hull */ ld = 0.0; for (mid = m_phLeft.GetBot(); mid &lt; m_phLeft.GetTop(); mid++) { if ((d1 = SPoint::DotProduct(*m_phLeft.GetpElt(mid), l)) &lt; 0) d1 = - d1; if (d1 &gt; ld) { ld = d1; le = m_phLeft.GetpElt(mid); } } } if ((m_phRight.GetTop() - m_phRight.GetBot()) &gt; 8) { /* right hull large */ lo = m_phRight.GetBot(); hi = m_phRight.GetTop() - 1; sbase = m_phRight.SlopeSign(hi, lo, l); do { brk = (lo + hi) / 2; if (sbase == (sbrk = m_phRight.SlopeSign(brk, brk+1, l))) if (sbase == (m_phRight.SlopeSign(lo, brk+1, l))) lo = brk + 1; else hi = brk; } while (sbase == sbrk &amp;&amp; lo &lt; hi); m1 = brk; while (lo &lt; m1) { mid = (lo + m1) / 2; if (sbase == (m_phRight.SlopeSign(mid, mid+1, l))) lo = mid + 1; else m1 = mid; } m2 = brk; while (m2 &lt; hi) { mid = (m2 + hi) / 2; if (sbase == (m_phRight.SlopeSign(mid, mid+1, l))) hi = mid; else m2 = mid + 1; }; if ((d1 = SPoint::DotProduct(*m_phRight.GetpElt(lo), l)) &lt; 0) d1 = - d1; if ((d2 = SPoint::DotProduct(*m_phRight.GetpElt(m2), l)) &lt; 0) d2 = - d2; rd = (d1 &gt; d2 ? (re = m_phRight.GetpElt(lo), d1) : (re = m_phRight.GetpElt(m2), d2)); } else { /* Few SPoints in righthull */ rd = 0.0; for (mid = m_phRight.GetBot(); mid &lt; m_phRight.GetTop(); mid++) { if ((d1 = SPoint::DotProduct(*m_phRight.GetpElt(mid), l)) &lt; 0) d1 = - d1; if (d1 &gt; rd) { rd = d1; re = m_phRight.GetpElt(mid); } } } } if (ld &gt; rd) if (ld * ld &gt; GetTol() * len_sq) { /* split left */ register int tmpo; while ((m_phLeft.GetHp() &gt;= 0) &amp;&amp; ( (tmpo = m_phLeft.GetpOp()[m_phLeft.GetHp()] ), ((re = m_phLeft.GetpHelt(m_phLeft.GetHp())) != le) || (tmpo != TPathHull&lt;T&gt;::StackPushOp))) { m_phLeft.DownHp(); switch (tmpo) { case TPathHull&lt;T&gt;::StackPushOp: m_phLeft.DownTop(); m_phLeft.UpBot(); break; case TPathHull&lt;T&gt;::StackTopOp: m_phLeft.UpTop(); m_phLeft.SetTopElt(re); break; case TPathHull&lt;T&gt;::StackBotOp: m_phLeft.DownBot(); m_phLeft.SetBotElt(re); break; } } Build(i, le); OutputVertex(DP(i, le)); Build(le, j); return DP(le, j); } else return(j); else /* extreme on right */ if (rd * rd &gt; GetTol() * len_sq) { /* split right or both */ if (m_pPHtag == re) Build(i, re); else { /* split right */ register int tmpo; while ((m_phRight.GetHp() &gt;= 0) &amp;&amp; ((tmpo = m_phRight.GetpOp()[m_phRight.GetHp()]), ((le = m_phRight.GetpHelt(m_phRight.GetHp())) != re) || (tmpo != TPathHull&lt;T&gt;::StackPushOp))) { m_phRight.DownHp(); switch (tmpo) { case TPathHull&lt;T&gt;::StackPushOp: m_phRight.DownTop(); m_phRight.UpBot(); break; case TPathHull&lt;T&gt;::StackTopOp: m_phRight.UpTop(); m_phRight.SetTopElt(le); break; case TPathHull&lt;T&gt;::StackBotOp: m_phRight.DownBot(); m_phRight.SetBotElt(le); break; } } } OutputVertex(DP(i, re)); Build(re, j); return(DP(re, j)); } else return(j); } </code></pre> <p>The error is:</p> <pre><code> dphull.h(155) : error C2664: 'hull::TDPHull&lt;T&gt;::DP' : cannot convert parameter 1 from 'hull::TLineApproximator&lt;T&gt;::SPoint *' to 'std::_Vector_iterator&lt;_Ty,_Alloc&gt;' with [ T=double ] and [ T=double ] and [ _Ty=hull::TLineApproximator&lt;double&gt;::SPoint, _Alloc=std::allocator&lt;hull::TLineApproximator&lt;double&gt;::SPoint&gt; ] No constructor could take the source type, or constructor overload resolution was ambiguous dphull.h(128) : while compiling class template member function 'std::_Vector_iterator&lt;_Ty,_Alloc&gt; hull::TDPHull&lt;T&gt;::DP(std::_Vector_iterator&lt;_Ty,_Alloc&gt;,std::_Vector_iterator&lt;_Ty,_Alloc&gt;)' with [ _Ty=hull::TLineApproximator&lt;double&gt;::SPoint, _Alloc=std::allocator&lt;hull::TLineApproximator&lt;double&gt;::SPoint&gt;, T=double ] d:\src\inc`lude\`pglline2dlod.h(127) : see reference to class template instantiation 'hull::TDPHull&lt;T&gt;' being compiled with [ T=double ] SPoint* i=&amp;(*it); </code></pre> <p>DP function def</p> <pre><code>template &lt;class T&gt; typename TLineApproximator&lt;T&gt;::PointContainer::iterator TDPHull&lt;typename T&gt;::DP(typename PointContainer::iterator it, typename PointContainer::iterator jt) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload