title: Definition of an array of pointer-to-members in combination with variadic templates
body: <p>In an embedded application, I'd like to create a helper class which holds a list of pointer-to-member-functions of a certain class, where the helper class calls the member functions in succession. At the moment, I'm having troubles with the definition statement of the static array which holds the pointers. This is the code:</p>
  
  <pre><code>template&lt;class C, class F&gt;
  struct FunctionSequence;
  
  template&lt;class C, class R, class... Args&gt;
  struct FunctionSequence&lt;C, R(Args...)&gt;
  {
      typedef R(C::*PointerToMember)(Args...);
  
      template&lt;PointerToMember... F&gt;
      struct Type
      {
          static const PointerToMember f[sizeof...(F)];
      };
  };
  
  template&lt;class C, class R, class... Args&gt;
  template&lt;typename FunctionSequence&lt;C, R(Args...)&gt;::PointerToMember... F&gt;
  const typename FunctionSequence&lt;C, R(Args...)&gt;::PointerToMember
      FunctionSequence&lt;C, R(Args...)&gt;::Type&lt;typename FunctionSequence&lt;C, R(Args...)&gt;::PointerToMember... F&gt;::f[sizeof...(F)]
          = { F... };
  
  struct Test
  {
      void m1(int) {}
      void m2(int) {}
  
      FunctionSequence&lt;Test, void(int)&gt;::Type&lt;&amp;Test::m1, &amp;Test::m2&gt; fs;
  };
  </code></pre>
  
  <p>Both Visual Studio 2013 and GCC 4.7.3 give errors on this line, where I'm trying to define the f variable, and initialize it with a list of the member function pointers:</p>
  
  <pre><code>FunctionSequence&lt;C, R(Args...)&gt;::Type&lt;typename FunctionSequence&lt;C, R(Args...)&gt;::PointerToMember... F&gt;::f[sizeof...(F)]
  </code></pre>
  
  <p>GCC gives the following errors:</p>
  
  <pre><code>expansion pattern 'typename FunctionSequence&lt;C, R(Args ...)&gt;::PointerToMember' contains no argument packs
  too many template-parameter-lists
  </code></pre>
  
  <p>Visual Studio gives the following errors:</p>
  
  <pre><code>error C3546: '...' : there are no parameter packs available to expand
  error C2146: syntax error : missing ',' before identifier 'F'
  error C3545: 'F': parameter pack expects a non-type template argument
  </code></pre>
  
  <p>Moreover, Visual Studio gives an additional error one line later:</p>
  
  <pre><code>error C3855: 'FunctionSequence&lt;C,R(Args...)&gt;::Type&lt;F...&gt;': template parameter 'F' is incompatible with the declaration
  </code></pre>
  
  <p>Is it even possible what I am trying to do? Is my code wrong, and is it fixable?</p>