17 Aug
2008
17 Aug
'08
11:45 p.m.
on Sun Aug 17 2008, Christian Larsen
f(shared_ptr<int>(new int(2)), g());
it surprises me that "new int(2)", and then "g()" can be evaluated _before_ the shared_ptr constructor.
Join the club.
Ok, so the correct way to do it in the last example is this?
auto_ptr<B> b1(new B); auto_ptr<B> b2(new B); A a(b1, b2);
Yep -- Dave Abrahams BoostPro Computing http://www.boostpro.com