Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2008-08-17 19:45:32


on Sun Aug 17 2008, Christian Larsen <contact-AT-dword.dk> wrote:

> 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

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net