Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It is quite tricky to generalize this syntax based on overloading the <code>operator,</code> operator, and the result looks awkward at best (if it works). I would recommend trying other options (eg. go for the <a href="http://eigen.tuxfamily.org/dox/classEigen_1_1DenseBase.html#a3dacded5374fe30f8d4eb4ae18bc87c9" rel="nofollow"><code>MatrixBase::operator&lt;&lt;(DenseBase&amp;)</code></a> operator).</p> <p>If you want it still, you must unpack the scalars one-by-one:</p> <pre><code>template&lt;typename T1, typename T2, class CI, int Current, int Height&gt; inline void gather (Array&lt;T1,Height,1&gt; &amp;to, const Array&lt;T2,Dynamic,1&gt; &amp;from, const Array&lt;int,Height,1&gt; &amp;index, CI&amp;&amp; ci, std::integral_constant&lt;int, Current&gt;*) { gather(to, from, index, (ci,from[index[Current]]), (std::integral_constant&lt;int, Current+1&gt;*)0); } template&lt;typename T1, typename T2, class CI, int Height&gt; inline void gather (Array&lt;T1,Height,1&gt; &amp;to, const Array&lt;T2,Dynamic,1&gt; &amp;from, const Array&lt;int,Height,1&gt; &amp;index, CI&amp;&amp; ci, std::integral_constant&lt;int, Height&gt;*) {} template&lt;typename T1, typename T2, int Height&gt; inline void gather (Array&lt;T1,Height,1&gt; &amp;to, const Array&lt;T2,Dynamic,1&gt; &amp;from, const Array&lt;int,Height,1&gt; &amp;index) { gather(to, from, index, (to &lt;&lt; index[from[0]]), (std::integral_constant&lt;int, 1&gt;*)0); } </code></pre> <p>Ugly, and there may be problems (you need to handle the <code>Dynamic</code> value, zero height if that's possible, there may be problems passing <code>CommaInitializers</code> to the recursion etc.)</p> <p>Plus, it has linear template instantiation depth (and IMHO that's unavoidable in this case).</p>
    singulars
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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