title: Pass method parameter to an action in googlemock
body: <p>I use Gmock for a method call, that returns an element of the QList heightsFromCsvResult as out parameter. Here is the currently working code:</p>
  
  <pre><code>EXPECT_CALL(*_mockAttributeRepository, getGeometryHeightValues(_,_))
      .WillOnce(DoAll(SetArgReferee&lt;1&gt;(heightsFromCsvResult.at(0)), Return(true)))
      .WillOnce(DoAll(SetArgReferee&lt;1&gt;(heightsFromCsvResult.at(1)), Return(true)))
      .WillOnce(DoAll(SetArgReferee&lt;1&gt;(heightsFromCsvResult.at(2)), Return(true)))
      .WillOnce(DoAll(SetArgReferee&lt;1&gt;(heightsFromCsvResult.at(3)), Return(true)));
  </code></pre>
  
  <p>The first parameter lineNumber from </p>
  
  <pre><code>getGeometryHeightValues(int lineNumber, QPair&lt;QString, QString&gt;) 
  </code></pre>
  
  <p>is the index for heightsFromCsvResult.at(lineNumber). </p>
  
  <p>Now I try to use Gmock in a more generic way:</p>
  
  <pre><code>int* mockLineNumber = new int;
  EXPECT_CALL(*_mockAttributeRepository, getGeometryHeightValues(_,_))
     .Times(4)
     .WillRepeatedly(DoAll(SaveArg&lt;0&gt;(mockLineNumber), SetArgReferee&lt;1&gt;(heightsFromCsvResult.at(*(mockLineNumber))), Return(true)));
  </code></pre>
  
  <p>But this code does not work, because mockLineNumber is never written by Gmock. But the EXPECT_CALL is satisfied.</p>
  
  <p>Does anyone see the problem in the code?</p>