Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#Actualrpiller

Posted 21 December 2013 - 02:54 PM

Thanks KulSeran, I missed that, or assumed since the return type had & in it that it would either give me an error or auto convert on the variable I was assigning it to.

 

 

Why is it when I step through the adding of my object to the container the ctor of AI with the parameter is called first, then the default ctor called? I assume my T(obj.GetID()) calls the one with the parameter and the container itself is calling the default one, and then is my explicit object getting copied into the container? If so, how deep is this coping because it seems to auto copy my int variable but what if I had other objects being created inside AI, would it copy all that too? This maybe seems to be the biggest downfall to storing non pointers. I originally was thinking not using pointers in the container would allocate on the stack but seems containers allocate the actual object it contains on the heap anyway, so to avoid copying and 2 ctors getting called seems like storing pointers would be the way to go anyway.


#1rpiller

Posted 21 December 2013 - 02:50 PM

Thanks KulSeran, I missed that, or assumed since the return type had & in it that it would either give me an error or auto convert on the variable I was assigning it to.


PARTNERS