Jos Timanta Tarigan wrote:
> Thx for the advice. really helpful. I just knew about default operator = 
> assignment.
> 
> Anyway, programming 101: 
> i have this kind of loop
> 
> for(int k = 0; k<10; k++)
> {
>   Vertex3 v1(0, 0, k);
>   //process v1 here
> }
> 
> and another version (but same function)
> 
> Vertex3 v1
> for(int k = 0; k<10; k++)
> {
>   v1.set(0, 0, k);
>   //process v1 here
> }
> 
> I have no intention to store v1. I just want to process it and get the 
> process result.
> 
> Is the second one more efficient than the second one?
> When I construct an object with same variable more than once, does it create 
> 10 object or it just replace the first one?

Step through with a debugger.  It depends on how the compiler optimizes 
the code, but the second one is probably more efficient as the first one 
will (logically) destroy and recreate the object each loop.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to