title: Why doesn't C++ detect when out of range vector elements are accessed with the [ ] operators by default?
body: <p>I understand that arrays are a primitive class and therefore do not have built in methods to detect out of range errors.  However, the vector class has the built in function .at() which does detect these errors.  By using namespaces, anyone can overload the [ ] symbols to act as the .at() function by throwing an error when a value out of the vector's range is accessed.  My question is this: why is this functionality not default in C++?</p>
  
  <p>EDIT: Below is an example in pseudocode (I believe - correct me if needed) of overloading the vector operator [ ]:</p>
  
  <pre><code>Item_Type&amp; operator[](size_t index) { // Verify that the index is legal.
  if (index &lt; 0 || index &gt;= num_items) {
     throw std::out_of_range
       ("index to operator[] is out of range");
  }
   return the_data[index]
  }
  </code></pre>
  
  <p>I believe this function can be written into a user-defined namespace and is reasonably easy to implement.  If this is true, why is it not default?</p>