title: Get a parameter pack from variable argument
body: <p>I'm trying to get a parameter pack from the list of arguments passed to a macro.</p>
  <pre><code>template&lt;std::size_t N, class T, class... Ts&gt;                                                                                                                                                                                                                                                                                                                              
  constexpr bool myFunctionHelper(const char (&amp;fmt)[N], std::size_t n);
  
  template &lt;std::size_t N, typename... Ts&gt;
  constexpr bool myFunction(const char (&amp;fmt)[N]) {
    return myFunctionHelper&lt;N, Ts...&gt;(fmt, 0);
  }
  
  #define FNC(fmt, ...)                                                       \                                                                                                                                                                                                                                                                                       
    do {                                                                      \                                                                                                                                                                                                                                                                                       
      static_assert(myFunction&lt;sizeof(fmt), decltype...(__VA_ARGS__)&gt;(fmt),   \
                    &quot;Incorrect arg types&quot;);                                   \
    } while (false)   
  </code></pre>
  <p>But decltype doesn't work as above (sizeof does though). Is there some method to get the parameter pack?</p>
  <p>It works if I pass the args to the myFunction and let compiler deduce the template type, but I can't pass the args further. args need not be constexpr.</p>
  <p>Edit:</p>
  <p><code>decltype(arg)</code> gives us the type of arg for any object. Here I'm trying to get the type info of multiple arguments as a parameter pack. If I use <code>decltype(__VA_ARGS__)</code>, the build succeeds but it just gives me the type of the last param in the <code>__VA_ARGS__</code>. For eg:</p>
  <pre><code>decltype(1, &quot;test&quot;, 4.0)
  </code></pre>
  <p>would translate to just <code>float</code>.</p>
  <p>There doesn't exists anything like <code>decltype...(args)</code> (<code>sizeof...(__VA_ARGS__)</code> does though).</p>
  <p>FNC would be used as follows</p>
  <pre><code>FNC(&quot;%d, %s, %0.2f\n&quot;, 1, &quot;test&quot;, 4.0);
  </code></pre>