title: Anyone know of a class that mimics Pascal's "range array"?
body: <p>I don't remember the exact name - I barely remember much about Pascal - but it was just an array that did some bounds checking so you could define and use something like this:</p>
  
  <pre><code>char arr[20..40];
  </code></pre>
  
  <p>and it would throw an out-of-bounds exception if you accessed element 15 or 60.</p>
  
  <p>In C++ I assume it would look something more like</p>
  
  <pre><code>vector&lt;char&gt; arr(20,40);
  </code></pre>
  
  <p>This is pretty simple to do with a class wrapper around a C++ array but I was hoping someone knew of something that used a vector.  Ideally I am looking for something where the range (and size) would dynamically change if (1) a setter was called or (2) and insertion/deletion was made but (3) attempts to access an invalid element still threw an exception.</p>
  
  <pre><code>arr.setUpper(50);
  </code></pre>
  
  <p>and</p>
  
  <pre><code>arr.push_back(element);  //adjust upper array bound
  </code></pre>
  
  <p>I am not yet up to speed on C++11 arrays so maybe they do something like this already?</p>