title: Why does the value assigned by get<>() in my code change outside the construct?
body: <p>Why is the output of statement <code>2</code> different from that of statement <code>1</code>? </p>
  
  <pre><code>// a is of type vector &lt; tuple &lt;int, int&gt; &gt;
  
  for (auto i: a)
  {
      get&lt;0&gt;(i)+=get&lt;1&gt;(i);                                       
      cout &lt;&lt; get&lt;0&gt;(i) &lt;&lt; " " &lt;&lt; get&lt;1&gt;(i) &lt;&lt; endl;              // 1
  }
  
  for (auto i: a) cout &lt;&lt; get&lt;0&gt;(i) &lt;&lt; " " &lt;&lt; get&lt;1&gt;(i) &lt;&lt; endl;  // 2
  </code></pre>
  
  <p>Suppose that initially, <code>a</code> contains <code>[7, 3] , [9, 1]</code></p>
  
  <p>Then <code>1</code> outputs </p>
  
  <pre><code>10 3
  10 1
  </code></pre>
  
  <p>whereas <code>2</code> outputs </p>
  
  <pre><code>7 3
  9 1
  </code></pre>
  
  <p>In short, the loop enclosing statement <code>1</code> seems to have no effect.</p>
  
  <p>I think it has something to do with my usage of <code>auto</code> and not using <code>*i</code> to change the value, but I don't think that we can use <code>*i</code> in <code>get</code>.</p>