title: int pointer to the .end() of a list
body: <p>I am currently working on creating a header file that acts like the standard library. I am in the progress of implemeing .end() for my linked list. In my cpp file I have an integer pointer which is expected to recieve the value of the .end() like</p>
  
  <pre><code>int* itrend;
  itrend = ca.end();
  </code></pre>
  
  <p><code>ca</code> is just an instance of my object in my header file.
  In my hpp file, I have a list iterator going to my <code>listofvalues.end()</code>. I would like to return the <code>.end()</code> value like</p>
  
  <pre><code>int* end() 
  {
      std::list&lt;value_type&gt;::iterator i = listOfValues.end();
      return (&amp;*i);
  
  }
  </code></pre>
  
  <p>My "List of values" is just a list holding several ints. eg </p>
  
  <pre><code>[1,2,3,4,5,6,7,8,9]
  </code></pre>
  
  <p>In my hpp file, I have a list iterator going to my <code>listofvalues.end()</code>. I would like to return the <code>.end()</code> value (which returns a list iterator); now this posess a problem that it returns the list iterator when I want to have an integer pointer. I have tried to deference it and take the address by using <code>&amp;*</code> and this will give an error saying  "List Iterator Not Dereferencable". I know it's because I'm trying to get the element after the last value, but that is exactly what I need to return, since I am trying to re-implement the linked list <code>.end()</code> method.</p>
  
  <p>Does anyone know how I can have an integer pointer point to the <code>List.end()</code>?</p>
  
  <p>Any assistance is appreciated.</p>