title: C++ - Fastest check array bounds
body: <p>I need a very fast way to check bounds of an array.
  My current check bounds is:</p>
  
  <pre><code>template&lt;typename T&gt;
  class SmartArray {
      //...
      int size;
      T* array;
      T &amp;operator[](int index) {
          if (index/size!=0)
              throw OUT_OF_RANGE; //#define OUT_OF_RANGE 0x0A
          return array[index];
      }
  }
  </code></pre>
  
  <p>There is faster way to check if index is out of array bounds?</p>
  
  <p>EDIT:</p>
  
  <p>My solution is making troubles with negative indexes.
  There is a way to fix this?</p>