title: Convert local object to pointer, without copying the data?
body: <p>I have a class <em>cnList</em> which stores a flexible number of items. This list must later be converted to a <em>cnArray</em> object. The list class already implements a method <code>cnArray cnList::toArray() const</code>.  </p>
  
  <p>But as you can see, it returns an object, not a reference nor a pointer.  But what I have to do after converting the list to an array, is to store this array for later use in a class member, this means, I need to have a pointer to that <em>cnArray</em> object.</p>
  
  <p>Now, the actual problem is, simply using the arrays adress is not an option because it gets freed after the method I'm currently in, ends.</p>
  
  <p>Can I somehow "convert" this object to a pointer and the object isn't freed anymore ?<br>
  Sure, I could copy all entries from the object-array to a pointed-array, but thats not what I want, since it's not very efficient.</p>
  
  <p>I am aware of the fact that I could implement a method in <em>cnList</em> that returns a pointer to a <em>cnArray</em> object, but I'd like to know if there is around this.</p>