title: Why can't I increment a variable of an enumerated type?
body: <p>I have a enumerated type <code>StackID</code>, and I am using the enumeration to refer to an index of a particular vector and it makes my code easier to read. </p>
  
  <p>However, I now have the need to create a variable called <code>nextAvail</code> of type <code>StackID</code>. (it actually refers to a particular stackID ). I tried to increment it but in C++, the following is illegal:</p>
  
  <pre><code>nextAvail++;
  </code></pre>
  
  <p>Which sort of makes sense to me ... because there's no bounds checking.</p>
  
  <p>I'm probably overlooking something obvious, but what's a good substitute?</p>
  
  <hr>
  
  <p>I also want to link to <a href="https://stackoverflow.com/questions/1390703/enumerate-over-an-enum-in-c/1391479#1391479">this</a> question.</p>