title: Passing temporary object to function
body: <p>I THINK this is called a temporary object. Here is my scenario:</p>
  
  <p>I have some functions:</p>
  
  <pre><code>void List&lt;T&gt;::Remove(ListIterator &amp;)
  ListIterator List&lt;T&gt;::Begin() //returns an iterator pointing to the first node in the list.
  </code></pre>
  
  <p>In G++ when I try to do something like this:</p>
  
  <pre><code>mylist.Remove(mylist.Begin())
  </code></pre>
  
  <p>I get the following error: </p>
  
  <p>no matching function for call to Remove(ListIterator). </p>
  
  <p>I don't have a function that takes a ListIterator by value and nor do I want one. However I'm not sure if what I'm trying to do even makes sense. The code works on windows VS2012 but not in g++. </p>
  
  <p>Any advice on how to either fix my implementation or an explanation of this behaviour is greatly appreciated!</p>