Note that there are some explanatory texts on larger screens.

plurals
  1. POcan a type tuple be unpacked later?
    primarykey
    data
    text
    <p>I have a tuple of types encoded as</p> <pre><code>template&lt;class... T&gt;struct packed; </code></pre> <p>I want to unpack it later like</p> <pre><code>template&lt;class T&gt;struct unpack; template&lt;class... T&gt; struct unpack&lt;packed&lt;T...&gt;&gt;{ //how to define the unpacked type here? }; </code></pre> <p>So that, I can use it as</p> <pre><code>template&lt;class Packed&gt; struct foo : unpack&lt;Packed&gt;::type...{}; </code></pre> <p>Note, I do not want to unpack the elements of the tuple immediately like</p> <pre><code>template&lt;class... T&gt; struct unpack&lt;packed&lt;T...&gt;&gt; : T...{}; template&lt;class Packed&gt; struct foo: unpack&lt;Packed&gt;{}; </code></pre> <p>I am interested to have elements of the tuple 'packed' to be direct base classes of 'foo' instead of indirect base classes via 'unack'. Also the elements of the type tuple are distinct non-primitive and non-final types.</p> <p>To make the example more detailed,</p> <pre><code>template&lt;class T, T... Values&gt; struct variadic_values{}; template&lt;class T,T From,class Encode,T To&gt; struct value_gen; template&lt;class T, T From, T... Values, T To&gt; struct value_gen&lt;T,From,variadic_values&lt;T,Values...&gt;,To&gt; { using type = typename value_gen&lt;T,From+1,variadic_values&lt;T,Values...,From&gt;,To&gt;::type; }; template&lt;class T,T From,T... Values&gt; struct value_gen&lt;T,From,variadic_values&lt;T,Values...&gt;,From&gt; { using type = variadic_values&lt;T,Values...&gt;; }; template&lt;class T, T From,T To&gt; using values = typename value_gen&lt;T,From,variadic_values&lt;T&gt;,To&gt;::type; template&lt;unsigned Idx,class T&gt; struct node{}; template&lt;class Idx,class... Ts&gt; struct unpack; template&lt;unsigned... Idx,class...Ts&gt; struct unpack&lt;variadic_values&lt;unsigned,Idx...&gt;,Ts...&gt; : node&lt;Idx,Ts&gt;...{}; template&lt;class... Ts&gt; class foo : unpack&lt;values&lt;unsigned,0,sizeof...(ts)&gt;,Ts...&gt;{}; </code></pre> <p>What I am interested to have is that <code>foo</code> should be directly derived from <code>node</code>s</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.
 

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