How to get a tuple based on list of template templates of variable size in C++? <p>I have created a template class which takes two plain template parameters (like int or double) and have derived several other classes from it:</p> <pre><code>template &lt;typename A, typename B&gt; class IClassBase {...} template &lt;typename B&gt; class Derived1Class : public IClassBase&lt;std::string, B&gt; {...} template &lt;typename B&gt; class Derived2Class : public IClassBase&lt;std::string, B&gt; {...} </code></pre> <p>I need to design a structure which would allow compiler to build a std::tuple based on list of template types and their parameters (B type in code snippet above).</p> <p>So given the list below </p> <pre><code>Derived1Class&lt;int&gt;, Derived1Class&lt;double&gt;, Derived2Class&lt;bool&gt;, Derived2Class&lt;std::string&gt; </code></pre> <p>compiler should infer following tuple:</p> <pre><code>std::tuple&lt;int, double, bool, std::string&gt; </code></pre> <p>Is this even possible, and if so, how it can be done in C++?</p> <p>Thanks in advance)</p>