Linked by MOS6510 on Thu 10th Jan 2013 23:25 UTC
Thread beginning with comment 548490
To view parent comment, click here.
To read all comments associated with this story, please click here.
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[6]: true, but some libraries...
by ebasconp on Sat 12th Jan 2013 13:32
in reply to "RE[5]: true, but some libraries..."
Not at all.
1. I replaced the classical "for loop" for the range based for loop, that hides complexity and improves reading a lot.
2. I used shared_ptr<Object> instead of Object*, so I do not need to iterate through all the vector elements to release them; the shared_ptr does the job.
3. Since the shared_ptr<Object> is a value type (storing a pointer), if an exception occurs, the vector will invoke the Object destructors automatically, making my code exception-safe.
All of that and my code is smaller 
RE[7]: true, but some libraries...
by tylerdurden on Sat 12th Jan 2013 21:01
in reply to "RE[6]: true, but some libraries..."





Member since:
2007-03-30
Did you just make code smaller than it needs to be just to make a point, as if lines matter