title: Is there some ninja trick to make a variable constant after its declaration?
body: <p>I know the answer is 99.99% no, but I figured it was worth a try, you never know.</p>
  
  <pre><code>void SomeFunction(int a)
  {
      // Here some processing happens on a, for example:
      a *= 50;
      a %= 10;
      if(example())
         a = 0;
      // From this point on I want to make "a" const; I don't want to allow
      // any code past this comment to modify it in any way.
  }
  </code></pre>
  
  <p>I can do something somewhat similar with <code>const int b = a;</code>, but it's not really the same and it creates a lot of confusion. A C++0x-only solution is acceptable.</p>
  
  <p><strong>EDIT</strong>: another less abstracted example, the one that made me ask this question:</p>
  
  <pre><code>void OpenFile(string path)
  {
      boost::to_lower(path);
      // I want path to be constant now
      ifstream ...
  }
  </code></pre>
  
  <p><strong>EDIT</strong>: another concrete example: <a href="https://stackoverflow.com/q/30836009">Recapture const-ness on variables in a parallel section</a>.</p>