title: How to get reference of elements in a vector
body: <p>I have to create a vector containing selected elements of another vector. Changes made in one vector should reflect in the other vector too. So I have to use reference of the elements which I intend to copy.</p>
  
  <p>For example,    </p>
  
  <pre><code>std::vector&lt;int&gt; a{1,2,3,4,5,6};
  std::vector&lt;int&gt; b;
  </code></pre>
  
  <p>Suppose if I copy odd numbers with reference to <code>b</code> vector, <code>b</code> will contain 1,3 and 5. If I change the values of <code>b</code>, same changes should be seen in <code>a</code> vector also.</p>
  
  <p>What it the method in STL to do this?</p>
  
  <p>EDIT:<br>
  I was in assumption that same memory address location can be shared by more than one variables.<br>
  The purpose of the above code was, to pass smaller vector of unknown variables,  to an external solver to be solved. Since changes will be automatically updated in the larger vector, I don't need to keep track of it. It seems I have to use pointers for the above purpose. </p>