title: std::length_error memory location 0x00000A31EBFF050 with vectors
body: <p>I am creating one application and got stuck with vector "reallocation". What I try to do is pass tuple<code>&lt;string, int, vector&lt;Log&gt; *&gt;</code> where 3rd element is pointer pointing on <code>vector&lt;vector&lt;Log&gt;&gt;</code>. Doing that on this way:  <code>Vector &lt;Log&gt; *pointer = &amp;arr[length];</code> . And when I try to print address it works as expected. Problem is happening when I try this : </p>
  
  <p><code>(*get&lt;2&gt;(*it)).resize(++get&lt;1&gt;(*it));</code></p>
  
  <p>Trying to reallocate like <code>(*pointer).resize();</code> Works </p>
  
  <p>What I am trying to make is tuple (something like relational databases) : </p>
  
  <p><code>tuple&lt;string, int, vector &lt;Log&gt; *&gt;</code> is unique id, number of entries for that id, pointer to address of first element of that row</p>
  
  <p>So basically I will have tuple with basic info about unique ids, number of rows for each IP and pointer to that specific row. </p>
  
  <p>First time when IP comes it's added to tuple and it's data stored on first place. Each other same IP will be checked in tuple and when it's found it's data need to be stored in next free space (with resizing by 1). Hope it's not too complicated to understand.</p>
  
  <p>Here is code I am currently using : (note that variable <code>a</code> is type <code>Log</code>)</p>
  
  <pre><code>typedef vector&lt;tuple&lt;string, int, vector &lt;Log&gt;*&gt;&gt; lookup_list;
  
  lookup_list lookup;
  vector&lt;vector&lt;Log&gt;&gt; arr;
  vector &lt;Log&gt; *pointer;
  int length = 0;
  string ip;
  
  for (int i = 0; i &lt; arr_size; i++){
   ip = a[i].ip_address;
  
  auto it = find_if(lookup.begin(), lookup.end(), [ip](const tuple&lt;string, int, vector &lt;Log&gt;*&gt;&amp; e){
       return get&lt;0&gt;(e) == ip;
  });
  
  if (it == lookup.end()){
     arr.resize(length + 1);
     arr[length].resize(1);
     pointer = &amp;arr[length];
     arr[length][0] = a[i];
     lookup.push_back(tuple&lt;string, int, vector &lt;Log&gt; *&gt;(ip, 1, pointer));
     length++;
  }
  else {
     get&lt;1&gt;(*it)++;
     (*get&lt;2&gt;(*it)).resize(get&lt;1&gt;(*it));
     (*get&lt;2&gt;(*it))[(get&lt;1&gt;(*it))-1] = a[i];
  }
  </code></pre>
  
  <p>Error I am getting is basically either trying to access memory that is out of bounds or _Xlength_error("vector too long");</p>
  
  <p>Should note that this happens on first IP that is same size, so not sure why that error is triggered...</p>