title: Initialization list for vector of function pointers in c++11
body: <p>I'm attempting to codify a DFA using a table of function pointers.</p>
  
  <p>The table is populated by function pointers to functions to either output something or move to another state in the table, all based off what input the machine receives.</p>
  
  <p>Right now what I can do is</p>
  
  <pre><code>function&lt;token* ()&gt; A1 = bind(A, &amp;data);
  function&lt;token* ()&gt; A2 = bind(B, &amp;data);
  function&lt;token* ()&gt; S1 = bind(S, 1);
  function&lt;token* ()&gt; S2 = bind(S, 2);
  
  vector&lt; function&lt;token* ()&gt; &gt; _table = { A1, A2, S1, S2 };
  </code></pre>
  
  <p>To make a 2x2 "table" where [0][0] performs action A1, [0][1] performs actions A2, [1][0] does shift to row 1, [1][1] does a shift to row 2... and so on.</p>
  
  <p>My question is, in c++11, is there any faster way to do this? My state table has grown to 60x150, I have 50 different actions all bound to different functions, and I have to define a shift function to get to each row.</p>
  
  <p>I'm trying to do this all in C++11's initialization features so it is done at compile time rather than at run time. </p>
  
  <p>Is it possible to create a macro or something that performs something like:</p>
  
  <pre><code>vector&lt;function&lt;token* ()&gt; &gt; S;
  for(int i = 0; i &lt; 60; i++){
    function&lt;token* ()&gt; S[i] = bind(S, i);
  }
  </code></pre>
  
  <p>so that after that I can reference <code>S[3]</code> or whatever and it gives me back the appropriately bound function pointer?</p>