title: Parameter pack expansion questions
body: <p>I managed to solve a previous question about initializing a static char array, asked here: <a href="https://stackoverflow.com/q/42450025/1371191">Initializing a static char based on template parameter</a></p>
  
  <p>I don't like the need for a secondary function in my solution:</p>
  
  <pre><code>//static char arr[N] = {[0]='0', [1]='x', [N-1]='\0',};
  // ideally want this, but not currently implemented in g++
  
  template &lt;char... chars&gt;
  struct zero_str {};
  
  template &lt;unsigned N, char... chars&gt;
  struct seq_gen { using type = typename seq_gen&lt;N-1, '0', chars...&gt;::type; };
  
  template &lt;char... chars&gt;
  struct seq_gen&lt;0, chars...&gt; { using type = zero_str&lt;chars...&gt;; };
  
  template &lt;size_t N&gt;
  struct zero_gen { using type = typename seq_gen&lt;N-1, '0', '\0'&gt;::type; };
  
  template &lt;&gt;
  struct zero_gen&lt;0&gt; { using type = zero_str&lt;'\0'&gt;; };
  
  template&lt;size_t N&gt; using strsize = typename zero_gen&lt;N&gt;::type;
  
  template&lt;typename T, char... chars&gt;
  const char* n2hexHelper(T val, zero_str&lt;chars...&gt;)
  {
      thread_local static char hexstr[] = {'0', 'x', chars...};
      /* convert to hex */
      return hexstr;
  };
  
  template&lt;typename T&gt;
  const char* n2hex(T val)
  {
      return n2hexHelper&lt;T&gt; (val, strsize&lt;sizeof(T)*2&gt;() );
  }
  
  int main()
  {
      std::cout &lt;&lt; n2hex(1) &lt;&lt; std::endl;
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>Instead, I'd prefer not to need the dummy variable passed to the helper function, and be able to do something like this:</p>
  
  <pre><code>template&lt;typename T, char... chars&gt;
  const char* n2HexIdeal(T val)
  {
      thread_local static char hexstr[] = {'0', 'x', chars...}; //how to get chars... ?
      /* convert to hex */
      return hexstr;
  }
  </code></pre>
  
  <p>I have two main questions. 1) is something like my ideal case possible with parameter pack expansions? Or is the only way to force the compiler to deduce my char... is to use it as a function parameter? 2) I'm not very familiar with template metaprogramming, so I was wondering if there are any glaring faults or idiomatic missteps with my above solution. </p>