Automatically check bounds in std::vector : <p>During active development of a class that uses <code>std::vector</code>, it often happens that an index is out of bounds. (See <a href="https://codereview.stackexchange.com/questions/183930">this code review question</a> for a practical example.) When using <code>operator[]</code>, this results in undefined behavior. Still, the <code>[]</code> syntax is easy to read an more convenient than writing <code>.at()</code>.</p>

<p>Therefore I'd like to write my code using the <code>[]</code> operator, but at the same time have bounds checks enabled. After testing the code, it should be very easy to remove the bounds checks.</p>

<p>I'm thinking of the following code:</p>

<pre><code>util::bound_checked&lt;std::vector&lt;int&gt;&gt; numbers;

numbers.push_back(1);
numbers.push_back(2);
numbers.push_back(3);
numbers.push_back(4);
std::cout &lt;&lt; numbers[17] &lt;&lt; "\n";
</code></pre>

<p>To me, this utility template seems to be so straight-forward that I'd expect it to exist. Does it? If so, under which name?</p>
