title: std::deque - subscript out of range
body: <p>I am writing a plugin for SA-MP, based on AMX and have occured an annoying problem. I am using a deque and a function to find &amp; delete an element. (like this one below)</p>
  
  <pre><code>enum PARAM_TYPE {
      PARAM_TYPE_CELL,
      PARAM_TYPE_ARRAY,
      PARAM_TYPE_STRING,
  };
  
  struct params_s {
      enum PARAM_TYPE type;
      struct params_s * next;
      cell free;
      cell numData;
      cell arrayData[0];
  };
  
  struct timer_s {
      AMX * amx;
      int id, func, interval, repeat;
      long long unsigned int trigger;
      struct params_s * params;
  };
  
  std::deque&lt;struct timer_s *&gt; gTimers;
  
  void DestroyTimer(struct timer_s * t) {
      for (int i = 0; i != gTimers.size(); ++i) {
          if (t == gTimers[i]) {
              gTimers.erase(gTimers.begin() + i);
              break;
          }
      }
  }
  </code></pre>
  
  <p>Whenever I call DestroyTimer() I get this error: </p>
  
  <pre><code>Debug Assertion Failed!
  Expression: deque subscript out of range
  </code></pre>
  
  <p>I can add elements, read and modify them, but I can't delete them.</p>
  
  <p>Thank you.</p>