title: Passing a vector by reference to function, but change doesn't persist
body: <p>I'm new to C++ so please forgive the noob question. In my program, I pass a vector of "Employee" objects to a function by reference, which calls an Employee member function on each object in the vector, to raise "salary" by "r" percent (in this case 2 percent). I've verified that this is happening by logging the call (the salary is changed within the function), but the changes don't persist...when I print the Employee objects again, the salaries are unchanged. Appreciate any help!</p>
  
  <pre><code>// main.cpp
  void raiseAllBy2Percent(vector&lt;Employee&gt; &amp;v)
  {
  for (int i = 0; i &lt; v.size(); i++)
      {
      Employee e = v[i];
      e.salaryRaise(2);
      }
  }
  
  // Employee.cpp
  void Employee::salaryRaise(double r)
  {
  cout &lt;&lt; "**salaryRaise called";
  _salary += (r/100 * _salary);
  cout &lt;&lt; "**new salary: " &lt;&lt; _salary; // This logs with the change as expected
  }
  </code></pre>