title: Local static const variables that may need to refer to different variables
body: <p>I have a function that has a variable called <code>static const int initial_var = some_var</code> so that on subsequent runs to the function, <code>initial_var</code> is guaranteed to not change. The issue is however the function may be called for different <code>some_var</code>s and because <code>initial_var</code> is used in calculations, this can screw things up.</p>
  
  <p><code>func()</code> is meant to operate on DIFFERENT variables, all named <code>some_var</code>. Their state needs to be remembered so I use a static const variable, but that will only remember the state for ONE variable.</p>
  
  <pre><code>void func()
  {
     static const int initial_var = some_var;
     some_var = initial_var; // This is the part where things may screw up if some_var
                             // is a different variable
  }
  </code></pre>
  
  <p>What's an elegant way to fix this?</p>